Run Run Run Run Class
Definition
Represents a discrete section of formatted or unformatted text.
public : sealed class Run : Inline, IRunpublic sealed class Run : Inline, IRunPublic NotInheritable Class Run Inherits Inline Implements IRun// This API is not available in Javascript.
<Run .../>
-or-
<Run ...>text</Run>
- Inheritance
- Attributes
| Device family |
Windows 10 (introduced v10.0.10240.0)
|
| API contract |
Windows.Foundation.UniversalApiContract (introduced v1)
|
Inherited Members
Inherited properties
Inherited events
Inherited methods
Examples
Each example shown here renders the same result. However, setting the Text property directly on the TextBlock has the best performance.
<!-- Set the TextBlock.Text property directy for best performance. -->
<TextBlock Text="This is some text."/>
<TextBlock><Run>This is some text.</Run></TextBlock>
<TextBlock><Run Text="This is some text."></Run></TextBlock>
// Set the TextBlock.Text property directy for best performance.
TextBlock textblock = new TextBlock();
textblock.Text = "This is some text.";
TextBlock textblock = new TextBlock();
Run run = new Run();
run.Text = "This is some text.";
textblock.Inlines.Add(run);
Remarks
A Run represents a discrete section of formatted or unformatted text and can be used in a TextBlock or RichTextBlock. You can place multiple Run elements inside of a Span.
When you use a TextBlock, set the TextBlock.Text property directly for best performance. You typically use the Run element only when you want to format a discrete section of text within the TextBlock.
For more examples, see
Constructors
Properties
FlowDirection FlowDirection FlowDirection FlowDirection
Gets or sets the direction that text and other user interface elements flow within the Run element that controls their layout.
public : FlowDirection FlowDirection { get; set; }public FlowDirection FlowDirection { get; set; }Public ReadWrite Property FlowDirection As FlowDirection// This API is not available in Javascript.
<Run FlowDirection="LeftToRight"/>
-or-
<Run FlowDirection="RightToLeft"/>
The direction that text and other user interface (UI) elements flow within the Run element. The default value is LeftToRight.
FlowDirectionProperty FlowDirectionProperty FlowDirectionProperty FlowDirectionProperty
Identifies the FlowDirection dependency property.
public : static DependencyProperty FlowDirectionProperty { get; }public static DependencyProperty FlowDirectionProperty { get; }Public Static ReadOnly Property FlowDirectionProperty As DependencyProperty// This API is not available in Javascript.
The identifier of the FlowDirection dependency property.
Text Text Text Text
Gets or sets the text contents of the Run.
public : PlatForm::String Text { get; set; }public string Text { get; set; }Public ReadWrite Property Text As string// This API is not available in Javascript.
<Run Text="text"/>
- Value
- PlatForm::String string string string
A string that specifies the text contents of the Run. The default is String.Empty.