This documentation is archived and is not being maintained.

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, 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.