Skip to main content

IPropertyAction<T> Interface

Definition

Assembly:Avalonia.Controls.RichTextEditor
Package:Avalonia.Controls.RichTextEditor

Represents an action that gets or sets a property value.

public interface IPropertyAction<T>

Remarks

Property actions are used for selection-based properties like font family, font size, and colors. They provide both the current value and available values for UI controls like combo boxes.

Methods

NameDescription
GetAvailableValuesGets the available values for this property.
GetValueGets the current property value for the selection.
SetValueSets the property value for the selection.

GetAvailableValues Method

Gets the available values for this property.

public System.Collections.Generic.IEnumerable<T> GetAvailableValues()

Returns

System.Collections.Generic.IEnumerable<T>

An enumerable of available values for combo box population, or null if the values should be determined by the UI.

Remarks

For font family, this returns system fonts. For font size, this returns common sizes (8, 9, 10, 11, 12, 14, 16, etc.).

GetValue Method

Gets the current property value for the selection.

public T GetValue(Avalonia.Controls.Documents.Primitives.ITextEditorHost host)

Parameters

host Avalonia.Controls.Documents.Primitives.ITextEditorHost

The editor host to query.

Returns

T

The property value if consistent across the selection; otherwise, the default value or null for mixed values.

SetValue Method

Sets the property value for the selection.

public void SetValue(Avalonia.Controls.Documents.Primitives.ITextEditorHost host, T value)

Parameters

host Avalonia.Controls.Documents.Primitives.ITextEditorHost

The editor host to modify.

value T

The value to apply.