Span Constructor (TextPointer, TextPointer)

 

Initializes a new instance of the Span class, taking two TextPointer objects that indicate the beginning and end of a selection of content that the new Span will contain.

Namespace:   System.Windows.Documents
Assembly:  PresentationFramework (in PresentationFramework.dll)

new : 
        start:TextPointer *
        end:TextPointer -> Span

Parameters

start
Type: System.Windows.Documents.TextPointer

A TextPointer that indicates the beginning of a selection of content that the new Span will contain.

end
Type: System.Windows.Documents.TextPointer

A TextPointer that indicates the end of a selection of content that the new Span will contain.

Exception Condition
ArgumentNullException

Raised when start or end is null.

ArgumentException

Raised when start and end do not resolve to a range of content suitable for enclosure by a Span element; for example, if start and end indicate positions in different paragraphs.

This constructor is intended to initialize a new Span element such that it encloses a selection of pre-existing content.

The following example shows how to use this constructor to create a new Span that is applied to a range of content. The range of content is determined by the start and end TextPointer objects specified by the constructor.

No code example is currently available or this language may not be supported.

The following figure shows how this example renders in a FlowDocument.

Screenshot: Three text runs

.NET Framework
Available since 3.0
Return to top
Show: