Run Run Run Run Class

Definition

Represents a discrete section of formatted or unformatted text.

public : sealed class Run : Inline, IRun
public sealed class Run : Inline, IRun
Public NotInheritable Class Run Inherits Inline Implements IRun
var run = new run();
<Run .../>
-or-
<Run ...>text</Run>
Inheritance
Attributes
Windows 10 requirements
Device family
Windows 10 (introduced v10.0.10240.0)
API contract
Windows.Foundation.UniversalApiContract (introduced v1)

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

Run() Run() Run() Run()

Initializes a new instance of the Run class.

public : Run()
public Run()
Public Sub New()
var run = new run();

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
var flowDirection = run.flowDirection;
run.flowDirection = flowDirection;
<Run FlowDirection="LeftToRight"/>
-or-
<Run FlowDirection="RightToLeft"/>
Value
FlowDirection FlowDirection FlowDirection FlowDirection

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
var dependencyProperty = Windows.UI.Xaml.Documents.Run.flowDirectionProperty;

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
var string = run.text;
run.text = string;
<Run Text="text"/>
Value
Platform::String string string string

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

AccessKey AccessKey AccessKey AccessKey

Inherited from TextElement

AccessKeyProperty AccessKeyProperty AccessKeyProperty AccessKeyProperty

Inherited from TextElement

AccessKeyScopeOwner AccessKeyScopeOwner AccessKeyScopeOwner AccessKeyScopeOwner

Inherited from TextElement

AccessKeyScopeOwnerProperty AccessKeyScopeOwnerProperty AccessKeyScopeOwnerProperty AccessKeyScopeOwnerProperty

Inherited from TextElement

AllowFocusOnInteraction AllowFocusOnInteraction AllowFocusOnInteraction AllowFocusOnInteraction

Inherited from TextElement

AllowFocusOnInteractionProperty AllowFocusOnInteractionProperty AllowFocusOnInteractionProperty AllowFocusOnInteractionProperty

Inherited from TextElement

CharacterSpacing CharacterSpacing CharacterSpacing CharacterSpacing

Inherited from TextElement

CharacterSpacingProperty CharacterSpacingProperty CharacterSpacingProperty CharacterSpacingProperty

Inherited from TextElement

ContentEnd ContentEnd ContentEnd ContentEnd

Inherited from TextElement

ContentStart ContentStart ContentStart ContentStart

Inherited from TextElement

Dispatcher Dispatcher Dispatcher Dispatcher

Inherited from DependencyObject

ElementEnd ElementEnd ElementEnd ElementEnd

Inherited from TextElement

ElementStart ElementStart ElementStart ElementStart

Inherited from TextElement

ExitDisplayModeOnAccessKeyInvoked ExitDisplayModeOnAccessKeyInvoked ExitDisplayModeOnAccessKeyInvoked ExitDisplayModeOnAccessKeyInvoked

Inherited from TextElement

ExitDisplayModeOnAccessKeyInvokedProperty ExitDisplayModeOnAccessKeyInvokedProperty ExitDisplayModeOnAccessKeyInvokedProperty ExitDisplayModeOnAccessKeyInvokedProperty

Inherited from TextElement

FontFamily FontFamily FontFamily FontFamily

Inherited from TextElement

FontFamilyProperty FontFamilyProperty FontFamilyProperty FontFamilyProperty

Inherited from TextElement

FontSize FontSize FontSize FontSize

Inherited from TextElement

FontSizeProperty FontSizeProperty FontSizeProperty FontSizeProperty

Inherited from TextElement

FontStretch FontStretch FontStretch FontStretch

Inherited from TextElement

FontStretchProperty FontStretchProperty FontStretchProperty FontStretchProperty

Inherited from TextElement

FontStyle FontStyle FontStyle FontStyle

Inherited from TextElement

FontStyleProperty FontStyleProperty FontStyleProperty FontStyleProperty

Inherited from TextElement

FontWeight FontWeight FontWeight FontWeight

Inherited from TextElement

FontWeightProperty FontWeightProperty FontWeightProperty FontWeightProperty

Inherited from TextElement

Foreground Foreground Foreground Foreground

Inherited from TextElement

ForegroundProperty ForegroundProperty ForegroundProperty ForegroundProperty

Inherited from TextElement

IsAccessKeyScope IsAccessKeyScope IsAccessKeyScope IsAccessKeyScope

Inherited from TextElement

IsAccessKeyScopeProperty IsAccessKeyScopeProperty IsAccessKeyScopeProperty IsAccessKeyScopeProperty

Inherited from TextElement

IsTextScaleFactorEnabled IsTextScaleFactorEnabled IsTextScaleFactorEnabled IsTextScaleFactorEnabled

Inherited from TextElement

IsTextScaleFactorEnabledProperty IsTextScaleFactorEnabledProperty IsTextScaleFactorEnabledProperty IsTextScaleFactorEnabledProperty

Inherited from TextElement

KeyTipHorizontalOffset KeyTipHorizontalOffset KeyTipHorizontalOffset KeyTipHorizontalOffset

Inherited from TextElement

KeyTipHorizontalOffsetProperty KeyTipHorizontalOffsetProperty KeyTipHorizontalOffsetProperty KeyTipHorizontalOffsetProperty

Inherited from TextElement

KeyTipPlacementMode KeyTipPlacementMode KeyTipPlacementMode KeyTipPlacementMode

Inherited from TextElement

KeyTipPlacementModeProperty KeyTipPlacementModeProperty KeyTipPlacementModeProperty KeyTipPlacementModeProperty

Inherited from TextElement

KeyTipVerticalOffset KeyTipVerticalOffset KeyTipVerticalOffset KeyTipVerticalOffset

Inherited from TextElement

KeyTipVerticalOffsetProperty KeyTipVerticalOffsetProperty KeyTipVerticalOffsetProperty KeyTipVerticalOffsetProperty

Inherited from TextElement

Language Language Language Language

Inherited from TextElement

LanguageProperty LanguageProperty LanguageProperty LanguageProperty

Inherited from TextElement

Name Name Name Name

Inherited from TextElement

TextDecorations TextDecorations TextDecorations TextDecorations

Inherited from TextElement

TextDecorationsProperty TextDecorationsProperty TextDecorationsProperty TextDecorationsProperty

Inherited from TextElement

Events

AccessKeyDisplayDismissed AccessKeyDisplayDismissed AccessKeyDisplayDismissed AccessKeyDisplayDismissed

Inherited from TextElement

AccessKeyDisplayRequested AccessKeyDisplayRequested AccessKeyDisplayRequested AccessKeyDisplayRequested

Inherited from TextElement

AccessKeyInvoked AccessKeyInvoked AccessKeyInvoked AccessKeyInvoked

Inherited from TextElement

Methods

ClearValue(DependencyProperty) ClearValue(DependencyProperty) ClearValue(DependencyProperty) ClearValue(DependencyProperty)

Inherited from DependencyObject

FindName(String) FindName(String) FindName(String) FindName(String)

Inherited from TextElement

GetAnimationBaseValue(DependencyProperty) GetAnimationBaseValue(DependencyProperty) GetAnimationBaseValue(DependencyProperty) GetAnimationBaseValue(DependencyProperty)

Inherited from DependencyObject

GetValue(DependencyProperty) GetValue(DependencyProperty) GetValue(DependencyProperty) GetValue(DependencyProperty)

Inherited from DependencyObject

OnDisconnectVisualChildren OnDisconnectVisualChildren OnDisconnectVisualChildren OnDisconnectVisualChildren

Inherited from TextElement

ReadLocalValue(DependencyProperty) ReadLocalValue(DependencyProperty) ReadLocalValue(DependencyProperty) ReadLocalValue(DependencyProperty)

Inherited from DependencyObject

RegisterPropertyChangedCallback(DependencyProperty,DependencyPropertyChangedCallback) RegisterPropertyChangedCallback(DependencyProperty,DependencyPropertyChangedCallback) RegisterPropertyChangedCallback(DependencyProperty,DependencyPropertyChangedCallback) RegisterPropertyChangedCallback(DependencyProperty,DependencyPropertyChangedCallback)

Inherited from DependencyObject

SetValue(DependencyProperty,Object) SetValue(DependencyProperty,Object) SetValue(DependencyProperty,Object) SetValue(DependencyProperty,Object)

Inherited from DependencyObject

UnregisterPropertyChangedCallback(DependencyProperty,Int64) UnregisterPropertyChangedCallback(DependencyProperty,Int64) UnregisterPropertyChangedCallback(DependencyProperty,Int64) UnregisterPropertyChangedCallback(DependencyProperty,Int64)

Inherited from DependencyObject

See Also