Table of Contents

Class TextElement

Namespace
Avalonia.Controls.Documents
Assembly
Avalonia.Controls.dll

TextElement is an base class for content in text based controls. TextElements span other content, applying property values or providing structural information.

public abstract class TextElement : StyledElement, INotifyPropertyChanged, IDataContextProvider, ILogical, IThemeVariantHost, IResourceHost, IResourceNode, IStyleHost, ISetLogicalParent, ISetInheritanceParent, ISupportInitialize, IStyleable, INamed
Inheritance
TextElement
Implements
Derived
Inherited Members
Extension Methods

Constructors

TextElement()

protected TextElement()

Fields

BackgroundProperty

Defines the Background property.

public static readonly StyledProperty<IBrush?> BackgroundProperty

Field Value

StyledProperty<IBrush>

FontFamilyProperty

Defines the FontFamily property.

public static readonly AttachedProperty<FontFamily> FontFamilyProperty

Field Value

AttachedProperty<FontFamily>

FontFeaturesProperty

Defines the FontFeatures property.

public static readonly AttachedProperty<FontFeatureCollection?> FontFeaturesProperty

Field Value

AttachedProperty<FontFeatureCollection>

FontSizeProperty

Defines the FontSize property.

public static readonly AttachedProperty<double> FontSizeProperty

Field Value

AttachedProperty<double>

FontStretchProperty

Defines the FontStretch property.

public static readonly AttachedProperty<FontStretch> FontStretchProperty

Field Value

AttachedProperty<FontStretch>

FontStyleProperty

Defines the FontStyle property.

public static readonly AttachedProperty<FontStyle> FontStyleProperty

Field Value

AttachedProperty<FontStyle>

FontWeightProperty

Defines the FontWeight property.

public static readonly AttachedProperty<FontWeight> FontWeightProperty

Field Value

AttachedProperty<FontWeight>

ForegroundProperty

Defines the Foreground property.

public static readonly AttachedProperty<IBrush?> ForegroundProperty

Field Value

AttachedProperty<IBrush>

Properties

Background

Gets or sets a brush used to paint the control's background.

public IBrush? Background { get; set; }

Property Value

IBrush

FontFamily

Gets or sets the font family.

public FontFamily FontFamily { get; set; }

Property Value

FontFamily

FontFeatures

Gets or sets the font features.

public FontFeatureCollection? FontFeatures { get; set; }

Property Value

FontFeatureCollection

FontSize

Gets or sets the font size.

public double FontSize { get; set; }

Property Value

double

FontStretch

Gets or sets the font stretch.

public FontStretch FontStretch { get; set; }

Property Value

FontStretch

FontStyle

Gets or sets the font style.

public FontStyle FontStyle { get; set; }

Property Value

FontStyle

FontWeight

Gets or sets the font weight.

public FontWeight FontWeight { get; set; }

Property Value

FontWeight

Foreground

Gets or sets a brush used to paint the text.

public IBrush? Foreground { get; set; }

Property Value

IBrush

Methods

GetFontFamily(Control)

Gets the value of the attached FontFamilyProperty on a control.

public static FontFamily GetFontFamily(Control control)

Parameters

control Control

The control.

Returns

FontFamily

The font family.

GetFontFeatures(Control)

Gets the value of the attached FontFeaturesProperty on a control.

public static FontFeatureCollection? GetFontFeatures(Control control)

Parameters

control Control

The control.

Returns

FontFeatureCollection

The font family.

GetFontSize(Control)

Gets the value of the attached FontSizeProperty on a control.

public static double GetFontSize(Control control)

Parameters

control Control

The control.

Returns

double

The font size.

GetFontStretch(Control)

Gets the value of the attached FontStretchProperty on a control.

public static FontStretch GetFontStretch(Control control)

Parameters

control Control

The control.

Returns

FontStretch

The font stretch.

GetFontStyle(Control)

Gets the value of the attached FontStyleProperty on a control.

public static FontStyle GetFontStyle(Control control)

Parameters

control Control

The control.

Returns

FontStyle

The font style.

GetFontWeight(Control)

Gets the value of the attached FontWeightProperty on a control.

public static FontWeight GetFontWeight(Control control)

Parameters

control Control

The control.

Returns

FontWeight

The font weight.

GetForeground(Control)

Gets the value of the attached ForegroundProperty on a control.

public static IBrush? GetForeground(Control control)

Parameters

control Control

The control.

Returns

IBrush

The foreground.

OnPropertyChanged(AvaloniaPropertyChangedEventArgs)

Called when a avalonia property changes on the object.

protected override void OnPropertyChanged(AvaloniaPropertyChangedEventArgs change)

Parameters

change AvaloniaPropertyChangedEventArgs

The property change details.

SetFontFamily(Control, FontFamily)

Sets the value of the attached FontFamilyProperty on a control.

public static void SetFontFamily(Control control, FontFamily value)

Parameters

control Control

The control.

value FontFamily

The property value to set.

SetFontFeatures(Control, FontFeatureCollection?)

Sets the value of the attached FontFeaturesProperty on a control.

public static void SetFontFeatures(Control control, FontFeatureCollection? value)

Parameters

control Control

The control.

value FontFeatureCollection

The property value to set.

SetFontSize(Control, double)

Sets the value of the attached FontSizeProperty on a control.

public static void SetFontSize(Control control, double value)

Parameters

control Control

The control.

value double

The property value to set.

SetFontStretch(Control, FontStretch)

Sets the value of the attached FontStretchProperty on a control.

public static void SetFontStretch(Control control, FontStretch value)

Parameters

control Control

The control.

value FontStretch

The property value to set.

SetFontStyle(Control, FontStyle)

Sets the value of the attached FontStyleProperty on a control.

public static void SetFontStyle(Control control, FontStyle value)

Parameters

control Control

The control.

value FontStyle

The property value to set.

SetFontWeight(Control, FontWeight)

Sets the value of the attached FontWeightProperty on a control.

public static void SetFontWeight(Control control, FontWeight value)

Parameters

control Control

The control.

value FontWeight

The property value to set.

SetForeground(Control, IBrush?)

Sets the value of the attached ForegroundProperty on a control.

public static void SetForeground(Control control, IBrush? value)

Parameters

control Control

The control.

value IBrush

The property value to set.