The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.

TextPointer.GetTextInRun Method (LogicalDirection, Char[], Int32, Int32)

Copies the specified maximum number of characters from any adjacent text in the specified direction into a caller-supplied character array.

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

public int GetTextInRun(
	LogicalDirection direction,
	char[] textBuffer,
	int startIndex,
	int count


Type: System.Windows.Documents.LogicalDirection

One of the LogicalDirection values that specifies the logical direction in which to find and copy any adjacent text.

Type: System.Char[]

A buffer into which any text is copied.

Type: System.Int32

An index into textBuffer at which to begin writing copied text.

Type: System.Int32

The maximum number of characters to copy.

Return Value

Type: System.Int32
The number of characters actually copied into textBuffer.


startIndex is less than 0 or greater than the Length property of textBuffer.


count is less than 0 or greater than the remaining space in textBuffer (textBuffer.Length minus startIndex).

This method returns only uninterrupted runs of text. Nothing is returned if any symbol type other than Text is adjacent to the current TextPointer in the specified direction. Similarly, text is returned only up to the next non-text symbol.

.NET Framework

Supported in: 4.6, 4.5, 4, 3.5, 3.0

.NET Framework Client Profile

Supported in: 4, 3.5 SP1

Windows 8.1, Windows Server 2012 R2, Windows 8, Windows Server 2012, Windows 7, Windows Vista SP2, Windows Server 2008 (Server Core Role not supported), Windows Server 2008 R2 (Server Core Role supported with SP1 or later; Itanium not supported)

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

© 2014 Microsoft