Skip to main content

NumberedMarkerStyleAction Class

Definition​

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

Action for changing the Avalonia.Controls.Documents.Primitives.DocumentNodes.TextMarkerStyle of numbered (ordered) lists.

public class NumberedMarkerStyleAction

Inheritance: object -> EditorAction -> NumberedMarkerStyleAction

Implements: IBlockPropertyAction, IBlockPropertyAction<TextMarkerStyle>, IEditorAction, IPropertyAction, IPropertyAction<TextMarkerStyle>

Remarks​

Avalonia.Controls.Documents.Primitives.Actions.NumberedMarkerStyleAction.CanExecute(Avalonia.Controls.Documents.Primitives.ITextEditorHost) returns true only when the caret is inside a numbered Avalonia.Controls.Documents.List (Decimal, LowerLatin, UpperLatin, LowerRoman, UpperRoman). Avalonia.Controls.Documents.Primitives.Actions.NumberedMarkerStyleAction.GetAvailableValues returns only the numbered marker styles.

Constructors​

NameDescription
NumberedMarkerStyleActionNo summary available.

NumberedMarkerStyleAction Constructor​

public NumberedMarkerStyleAction()

Methods​

NameDescription
CanExecuteGets whether the action can currently execute.
ClearValueClears the marker style. A list always has one, so this does nothing.
ExecuteExecutes the action synchronously.
ExecuteAsyncExecutes the action asynchronously. Inherited from EditorAction.
GetAvailableValuesReturns numbered Avalonia.Controls.Documents.Primitives.DocumentNodes.TextMarkerStyle values.
GetStateGets the current state of the action.
GetValueGets the current marker style of the first numbered list containing the caret/selection.
HasConsistentValueGets whether all affected blocks have the same value for this property.
SetValueSets the marker style on all numbered lists covering the selection.

CanExecute Method​

Gets whether the action can currently execute.

public bool CanExecute(Avalonia.Controls.Documents.Primitives.ITextEditorHost host)

Parameters​

host Avalonia.Controls.Documents.Primitives.ITextEditorHost

The editor host to check against.

Returns​

bool

True if the action can execute; otherwise, false.

Remarks​

This is called frequently to update UI state (button enabled/disabled). Implementations should be fast and avoid heavy computation.

ClearValue Method​

Clears the marker style. A list always has one, so this does nothing.

public void ClearValue(Avalonia.Controls.Documents.Primitives.ITextEditorHost host)

Parameters​

host Avalonia.Controls.Documents.Primitives.ITextEditorHost

The editor to act on.

Execute Method​

Executes the action synchronously.

public void Execute(Avalonia.Controls.Documents.Primitives.ITextEditorHost host)

Parameters​

host Avalonia.Controls.Documents.Primitives.ITextEditorHost

The editor host to execute on.

Remarks​

For actions that require async operations (like file dialogs), use Avalonia.Controls.Documents.Primitives.Actions.IEditorAction.ExecuteAsync(Avalonia.Controls.Documents.Primitives.ITextEditorHost) instead.

GetAvailableValues Method​

Returns numbered Avalonia.Controls.Documents.Primitives.DocumentNodes.TextMarkerStyle values.

public System.Collections.Generic.IEnumerable<Avalonia.Controls.Documents.Primitives.DocumentNodes.TextMarkerStyle> GetAvailableValues()

Returns​

System.Collections.Generic.IEnumerable<Avalonia.Controls.Documents.Primitives.DocumentNodes.TextMarkerStyle>

GetState Method​

Gets the current state of the action.

public object GetState(Avalonia.Controls.Documents.Primitives.ITextEditorHost host)

Parameters​

host Avalonia.Controls.Documents.Primitives.ITextEditorHost

The editor host to query.

Returns​

object

The current state, or null if the action has no state. A toggle action returns a boolean, a property action the current value.

Remarks​

Read Avalonia.Controls.Documents.Primitives.Actions.IToggleAction.IsChecked(Avalonia.Controls.Documents.Primitives.ITextEditorHost) or Avalonia.Controls.Documents.Primitives.Actions.IPropertyAction.GetValueAsObject(Avalonia.Controls.Documents.Primitives.ITextEditorHost) instead. Both say which family the value came from, which an untyped object cannot.

GetValue Method​

Gets the current marker style of the first numbered list containing the caret/selection.

public Avalonia.Controls.Documents.Primitives.DocumentNodes.TextMarkerStyle GetValue(Avalonia.Controls.Documents.Primitives.ITextEditorHost host)

Parameters​

host Avalonia.Controls.Documents.Primitives.ITextEditorHost

Returns​

Avalonia.Controls.Documents.Primitives.DocumentNodes.TextMarkerStyle

HasConsistentValue Method​

Gets whether all affected blocks have the same value for this property.

public bool HasConsistentValue(Avalonia.Controls.Documents.Primitives.ITextEditorHost host)

Parameters​

host Avalonia.Controls.Documents.Primitives.ITextEditorHost

The editor host.

Returns​

bool

True if all affected blocks have the same property value. False if blocks have different values (mixed state).

Remarks​

UI controls should show a mixed/indeterminate state when this returns false. For example, a ComboBox might show "Mixed" placeholder text.

For collapsed selections, this always returns true (single block).

SetValue Method​

Sets the marker style on all numbered lists covering the selection.

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

Parameters​

host Avalonia.Controls.Documents.Primitives.ITextEditorHost

value Avalonia.Controls.Documents.Primitives.DocumentNodes.TextMarkerStyle

Properties​

NameDescription
DisplayNameGets the display name for UI purposes.
GestureGets the optional keyboard gesture for this action. Inherited from EditorAction.
IdGets the unique identifier for this action.

DisplayName Property​

Gets the display name for UI purposes.

public string DisplayName { get; set; }

Remarks​

This is used for tooltips, menu items, and accessibility.

Id Property​

Gets the unique identifier for this action.

public string Id { get; set; }

Remarks​

IDs follow a hierarchical naming convention: