Run.Text Property

Gets or sets the text contents of the Run.

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

public string Text { get; set; }
<Run ...>text</Run>
<Run Text="text"/>

Property Value

Type: System.String
A string that specifies the text contents of the Run. The default is String.Empty.

Any leading or trailing white space is not preserved when you set the Text property in XAML or in code.

When you set text in a TextBlock or a Run, it is not necessary to explicitly specify the Text property in XAML. Instead, you can put the text directly within the element, as shown in the following example.

<TextBlock>Hello, world!</TextBlock>
<TextBlock>
  <TextBlock.Inlines>
    <Run>Hello again, world!</Run>
  </TextBlock.Inlines>
</TextBlock>

Silverlight

Supported in: 5, 4, 3

Silverlight for Windows Phone

Supported in: Windows Phone OS 7.1, Windows Phone OS 7.0

For a list of the operating systems and browsers that are supported by Silverlight, see Supported Operating Systems and Browsers.

Community Additions

ADD
Show: