Text Property
Collapse the table of content
Expand the table of content

Run.Text Property

[ This article is for Windows Phone 8 developers. If you’re developing for Windows 10, see the latest documentation. ]

Gets or sets the text contents of the Run.

Namespace:  System.Windows.Documents
Assembly:  System.Windows (in System.Windows.dll)
XMLNS for XAML: Not mapped to an xmlns.

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>

Windows Phone OS

Supported in: 8.1, 8.0, 7.1, 7.0

Windows Phone

Show:
© 2016 Microsoft