Export (0) Print
Expand All

Run.Run(String, TextPointer) Constructor

Initializes a new instance of the Run class, taking a specified string as the initial contents of the text run, and a TextPointer specifying an insertion position for the text run.

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

public Run (
	string text,
	TextPointer insertionPosition
public Run (
	String text, 
	TextPointer insertionPosition
public function Run (
	text : String, 
	insertionPosition : TextPointer
You cannot use constructors in XAML.



A string specifying the initial contents of the Run object.


A TextPointer specifying an insertion position at which to insert the text run after it is created, or null for no automatic insertion.

The following example demonstrates usage of this constructor.

// Create a new, empty paragraph to host the text run.
Paragraph par = new Paragraph();

// Get a TextPointer for the end of content in the paragraph.
TextPointer insertionPoint = par.ContentEnd;

// This line will create a new text run, initialize it with the supplied string,
// and insert it at the specified insertion point (which happens to be the end of
// content for the host paragraph).
Run textRun = new Run("The text contents of this text run.", insertionPoint);

Windows 98, Windows Server 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

The Microsoft .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.

.NET Framework

Supported in: 3.0

Community Additions

© 2015 Microsoft