This documentation is archived and is not being maintained.

TextRun Class

Represents a sequence of characters that share a single property set.

Namespace:  System.Windows.Media.TextFormatting
Assembly:  PresentationCore (in PresentationCore.dll)

public ref class TextRun abstract

The TextRun type exposes the following members.

  NameDescription
Protected methodTextRunCreates an instance of a TextRun object.
Top

  NameDescription
Public propertyCharacterBufferReferenceGets a reference to the text run character buffer.
Public propertyLengthGets the number of characters in the text run.
Public propertyPropertiesGets the set of text properties that are shared by every character in the text run, such as typeface or foreground brush.
Top

  NameDescription
Public methodEquals(Object)Determines whether the specified Object is equal to the current Object. (Inherited from Object.)
Protected methodFinalizeAllows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection. (Inherited from Object.)
Public methodGetHashCodeServes as a hash function for a particular type. (Inherited from Object.)
Public methodGetTypeGets the Type of the current instance. (Inherited from Object.)
Protected methodMemberwiseCloneCreates a shallow copy of the current Object. (Inherited from Object.)
Public methodToStringReturns a string that represents the current object. (Inherited from Object.)
Top

A text run is a sequence of characters sharing a single property set. Any change to the format, such as font style, foreground color, font family, or any other formatting effect, breaks the text run. The following example illustrates how changes in formatting to a text string results in a series of text runs—each text run has a common set of formatting properties.

The TextRun class is the root of a type hierarchy representing several types of text content processed by TextFormatter. Each class that is derived from TextRun represents a distinct type of text content.

Class

Description

TextRun

Root of the hierarchy. Defines a group of characters that share the same set of character properties.

TextCharacters

Defines a collection of character glyphs from a distinct physical typeface.

TextEmbeddedObject

Defines a type of text content in which measuring, hit testing, and drawing of the entire content is done as a distinct entity. An example of this type of content is a button in the middle of the line of text.

TextEndOfLine

Defines a line-break character code.

TextEndOfParagraph

Defines a paragraph-break character code. Derives from TextEndOfLine.

TextEndOfSegment

Defines a segment break marker.

TextHidden

Defines a range of non-visible characters.

TextModifier

Defines the beginning of a modification scope.

In the following example, an override for the GetTextRun method is implemented.

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

.NET Framework

Supported in: 4, 3.5, 3.0

.NET Framework Client Profile

Supported in: 4, 3.5 SP1

Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.
Show: