Class TextElement
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
FontFamilyProperty
Defines the FontFamily property.
public static readonly AttachedProperty<FontFamily> FontFamilyProperty
Field Value
FontFeaturesProperty
Defines the FontFeatures property.
public static readonly AttachedProperty<FontFeatureCollection?> FontFeaturesProperty
Field Value
FontSizeProperty
Defines the FontSize property.
public static readonly AttachedProperty<double> FontSizeProperty
Field Value
FontStretchProperty
Defines the FontStretch property.
public static readonly AttachedProperty<FontStretch> FontStretchProperty
Field Value
FontStyleProperty
Defines the FontStyle property.
public static readonly AttachedProperty<FontStyle> FontStyleProperty
Field Value
FontWeightProperty
Defines the FontWeight property.
public static readonly AttachedProperty<FontWeight> FontWeightProperty
Field Value
ForegroundProperty
Defines the Foreground property.
public static readonly AttachedProperty<IBrush?> ForegroundProperty
Field Value
Properties
Background
Gets or sets a brush used to paint the control's background.
public IBrush? Background { get; set; }
Property Value
FontFamily
Gets or sets the font family.
public FontFamily FontFamily { get; set; }
Property Value
FontFeatures
Gets or sets the font features.
public FontFeatureCollection? FontFeatures { get; set; }
Property Value
FontSize
Gets or sets the font size.
public double FontSize { get; set; }
Property Value
FontStretch
Gets or sets the font stretch.
public FontStretch FontStretch { get; set; }
Property Value
FontStyle
Gets or sets the font style.
public FontStyle FontStyle { get; set; }
Property Value
FontWeight
Gets or sets the font weight.
public FontWeight FontWeight { get; set; }
Property Value
Foreground
Gets or sets a brush used to paint the text.
public IBrush? Foreground { get; set; }
Property Value
Methods
GetFontFamily(Control)
Gets the value of the attached FontFamilyProperty on a control.
public static FontFamily GetFontFamily(Control control)
Parameters
control
ControlThe 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
ControlThe 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
ControlThe 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
ControlThe 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
ControlThe 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
ControlThe 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
ControlThe control.
Returns
- IBrush
The foreground.
OnPropertyChanged(AvaloniaPropertyChangedEventArgs)
Called when a avalonia property changes on the object.
protected override void OnPropertyChanged(AvaloniaPropertyChangedEventArgs change)
Parameters
change
AvaloniaPropertyChangedEventArgsThe 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
ControlThe control.
value
FontFamilyThe 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
ControlThe control.
value
FontFeatureCollectionThe 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
SetFontStretch(Control, FontStretch)
Sets the value of the attached FontStretchProperty on a control.
public static void SetFontStretch(Control control, FontStretch value)
Parameters
control
ControlThe control.
value
FontStretchThe 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
SetFontWeight(Control, FontWeight)
Sets the value of the attached FontWeightProperty on a control.
public static void SetFontWeight(Control control, FontWeight value)
Parameters
control
ControlThe control.
value
FontWeightThe 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)