Skip to main content

Run Class

Definition

Assembly:Avalonia.Controls
Package:Avalonia
Source:Run.cs

A terminal element in text flow hierarchy - contains a uniformatted run of unicode characters

public class Run

Inheritance: object -> AvaloniaObject -> Animatable -> StyledElement -> TextElement -> Inline -> Run

Constructors

NameDescription
Run (2 overloads)Initializes an instance of Run class.

Run overloads

Run Constructor

Initializes an instance of Run class.

public Run()

Run Constructor

Initializes an instance of Run class specifying its text content.

public Run(string text)
Parameters

text string

Text content assigned to the Run.

Methods

NameDescription
GetTextDecorationsGets the value of the attached Avalonia.Controls.Documents.Inline.TextDecorationsProperty on a control. Inherited from Inline.
SetTextDecorationsSets the value of the attached Avalonia.Controls.Documents.Inline.TextDecorationsProperty on a control. Inherited from Inline.
GetFontFamilyGets the value of the attached Avalonia.Controls.Documents.TextElement.FontFamilyProperty on a control. Inherited from TextElement.
GetFontFeaturesGets the value of the attached Avalonia.Controls.Documents.TextElement.FontFeaturesProperty on a control. Inherited from TextElement.
GetFontSizeGets the value of the attached Avalonia.Controls.Documents.TextElement.FontSizeProperty on a control. Inherited from TextElement.
GetFontStretchGets the value of the attached Avalonia.Controls.Documents.TextElement.FontStretchProperty on a control. Inherited from TextElement.
GetFontStyleGets the value of the attached Avalonia.Controls.Documents.TextElement.FontStyleProperty on a control. Inherited from TextElement.
GetFontWeightGets the value of the attached Avalonia.Controls.Documents.TextElement.FontWeightProperty on a control. Inherited from TextElement.
GetForegroundGets the value of the attached Avalonia.Controls.Documents.TextElement.ForegroundProperty on a control. Inherited from TextElement.
GetLetterSpacingGets the value of the attached Avalonia.Controls.Documents.TextElement.LetterSpacingProperty on a control. Inherited from TextElement.
SetFontFamilySets the value of the attached Avalonia.Controls.Documents.TextElement.FontFamilyProperty on a control. Inherited from TextElement.
SetFontFeaturesSets the value of the attached Avalonia.Controls.Documents.TextElement.FontFeaturesProperty on a control. Inherited from TextElement.
SetFontSizeSets the value of the attached Avalonia.Controls.Documents.TextElement.FontSizeProperty on a control. Inherited from TextElement.
SetFontStretchSets the value of the attached Avalonia.Controls.Documents.TextElement.FontStretchProperty on a control. Inherited from TextElement.
SetFontStyleSets the value of the attached Avalonia.Controls.Documents.TextElement.FontStyleProperty on a control. Inherited from TextElement.
SetFontWeightSets the value of the attached Avalonia.Controls.Documents.TextElement.FontWeightProperty on a control. Inherited from TextElement.
SetForegroundSets the value of the attached Avalonia.Controls.Documents.TextElement.ForegroundProperty on a control. Inherited from TextElement.
SetLetterSpacingSets the value of the attached Avalonia.Controls.Documents.TextElement.LetterSpacingProperty on a control. Inherited from TextElement.
ApplyStylingApplies styling to the control if the control is initialized and styling is not already applied. Inherited from StyledElement.
BeginInitInherited from StyledElement.
EndInitInherited from StyledElement.
TryGetResourceInherited from StyledElement.
Bind (8 overloads)Binds a Avalonia.AvaloniaProperty to an Avalonia.Data.BindingBase. Inherited from AvaloniaObject.
CheckAccessReturns a value indicating whether the current thread is the UI thread. Inherited from AvaloniaObject.
ClearValue (4 overloads)Clears a Avalonia.AvaloniaProperty's local value. Inherited from AvaloniaObject.
CoerceValueCoerces the specified Avalonia.AvaloniaProperty. Inherited from AvaloniaObject.
EqualsCompares two objects using reference equality. Inherited from AvaloniaObject.
GetBaseValueInherited from AvaloniaObject.
GetHashCodeGets the hash code for the object. Inherited from AvaloniaObject.
GetValue (3 overloads)Gets a Avalonia.AvaloniaProperty value. Inherited from AvaloniaObject.
IsAnimatingChecks whether a Avalonia.AvaloniaProperty is animating. Inherited from AvaloniaObject.
IsSetChecks whether a Avalonia.AvaloniaProperty is set on this object. Inherited from AvaloniaObject.
SetCurrentValue (2 overloads)Sets the value of a dependency property without changing its value source. Inherited from AvaloniaObject.
SetValue (3 overloads)Sets a Avalonia.AvaloniaProperty value. Inherited from AvaloniaObject.
VerifyAccessChecks that the current thread is the UI thread and throws if not. Inherited from AvaloniaObject.

Properties

NameDescription
TextThe content spanned by this TextElement.
BaselineAlignmentDescribes how the baseline for a text-based element is positioned on the vertical axis, relative to the established baseline for text. Inherited from Inline.
TextDecorationsThe TextDecorations property specifies decorations that are added to the text of an element. Inherited from Inline.
BackgroundGets or sets a brush used to paint the control's background. Inherited from TextElement.
FontFamilyGets or sets the font family. Inherited from TextElement.
FontFeaturesGets or sets the font features. Inherited from TextElement.
FontSizeGets or sets the font size. Inherited from TextElement.
FontStretchGets or sets the font stretch. Inherited from TextElement.
FontStyleGets or sets the font style. Inherited from TextElement.
FontWeightGets or sets the font weight. Inherited from TextElement.
ForegroundGets or sets a brush used to paint the text. Inherited from TextElement.
LetterSpacingGets or sets the letter spacing. Inherited from TextElement.
ActualThemeVariantGets the UI theme that is currently used by the element, which might be different than the RequestedThemeVariantProperty. Inherited from StyledElement.
ClassesGets or sets the styled element's classes. Inherited from StyledElement.
DataContextGets or sets the control's data context. Inherited from StyledElement.
IsInitializedGets a value that indicates whether the element has finished initialization. Inherited from StyledElement.
NameGets or sets the name of the styled element. Inherited from StyledElement.
ParentGets the styled element's logical parent. Inherited from StyledElement.
ResourcesGets or sets the styled element's resource dictionary. Inherited from StyledElement.
StyleKeyGets the type by which the element is styled. Inherited from StyledElement.
StylesGets the styles for the styled element. Inherited from StyledElement.
TemplatedParentGets the styled element whose lookless template this styled element is part of. Inherited from StyledElement.
ThemeGets or sets the theme to be applied to the element. Inherited from StyledElement.
TransitionsGets or sets the property transitions for the control. Inherited from Animatable.
DispatcherReturns the Avalonia.AvaloniaObject.Dispatcher that this Avalonia.AvaloniaObject is associated with. Inherited from AvaloniaObject.
ItemInherited from AvaloniaObject.

Text Property

The content spanned by this TextElement.

public string Text { get; set; }

Fields

NameDescription
TextPropertyDependency property backing Text.
BaselineAlignmentPropertyAvaloniaProperty for Avalonia.Controls.Documents.Inline.BaselineAlignment property. Inherited from Inline.
TextDecorationsPropertyAvaloniaProperty for Avalonia.Controls.Documents.Inline.TextDecorations property. Inherited from Inline.
BackgroundPropertyDefines the Avalonia.Controls.Documents.TextElement.Background property. Inherited from TextElement.
FontFamilyPropertyDefines the Avalonia.Controls.Documents.TextElement.FontFamily property. Inherited from TextElement.
FontFeaturesPropertyDefines the Avalonia.Controls.Documents.TextElement.FontFeatures property. Inherited from TextElement.
FontSizePropertyDefines the Avalonia.Controls.Documents.TextElement.FontSize property. Inherited from TextElement.
FontStretchPropertyDefines the Avalonia.Controls.Documents.TextElement.FontStretch property. Inherited from TextElement.
FontStylePropertyDefines the Avalonia.Controls.Documents.TextElement.FontStyle property. Inherited from TextElement.
FontWeightPropertyDefines the Avalonia.Controls.Documents.TextElement.FontWeight property. Inherited from TextElement.
ForegroundPropertyDefines the Avalonia.Controls.Documents.TextElement.Foreground property. Inherited from TextElement.
LetterSpacingPropertyDefines the Avalonia.Controls.Documents.TextElement.LetterSpacing property. Inherited from TextElement.
DataContextPropertyDefines the Avalonia.StyledElement.DataContext property. Inherited from StyledElement.
NamePropertyDefines the Avalonia.StyledElement.Name property. Inherited from StyledElement.
ParentPropertyDefines the Avalonia.StyledElement.Parent property. Inherited from StyledElement.
TemplatedParentPropertyDefines the Avalonia.StyledElement.TemplatedParent property. Inherited from StyledElement.
ThemePropertyDefines the Avalonia.StyledElement.Theme property. Inherited from StyledElement.
TransitionsPropertyDefines the Avalonia.Animation.Animatable.Transitions property. Inherited from Animatable.

TextProperty Field

Dependency property backing Text.

public Avalonia.StyledProperty<string> TextProperty

Remarks

Note that when a TextRange that intersects with this Run gets modified (e.g. by editing a selection in RichTextBox), we will get two changes to this property since we delete and then insert when setting the content of a TextRange.

Events

NameDescription
ActualThemeVariantChangedRaised when the theme variant is changed on the element or an ancestor of the element. Inherited from StyledElement.
AttachedToLogicalTreeRaised when the styled element is attached to a rooted logical tree. Inherited from StyledElement.
DataContextChangedOccurs when the Avalonia.StyledElement.DataContext property changes. Inherited from StyledElement.
DetachedFromLogicalTreeRaised when the styled element is detached from a rooted logical tree. Inherited from StyledElement.
InitializedOccurs when the styled element has finished initialization. Inherited from StyledElement.
ResourcesChangedOccurs when a resource in this styled element or a parent styled element has changed. Inherited from StyledElement.
PropertyChangedRaised when a Avalonia.AvaloniaProperty value changes on this object. Inherited from AvaloniaObject.