BulletMarkerStyleAction Class
Definition
Action for changing the Avalonia.Controls.Documents.Primitives.DocumentNodes.TextMarkerStyle of bullet (unordered) lists.
public class BulletMarkerStyleAction
Remarks
Avalonia.Controls.Documents.Primitives.Actions.BulletMarkerStyleAction.CanExecute(Avalonia.Controls.Documents.Primitives.ITextEditorHost) returns true only when the caret is inside a bullet Avalonia.Controls.Documents.List (Disc, Circle, Square, Box, or None). Avalonia.Controls.Documents.Primitives.Actions.BulletMarkerStyleAction.GetAvailableValues returns only the bullet marker styles.
Constructors
| Name | Description |
|---|---|
| BulletMarkerStyleAction | No summary available. |
BulletMarkerStyleAction Constructor
public BulletMarkerStyleAction()
Methods
| Name | Description |
|---|---|
| CanExecute | Gets whether the action can currently execute. |
| Execute | Executes the action synchronously. |
| GetAvailableValues | Returns bullet Avalonia.Controls.Documents.Primitives.DocumentNodes.TextMarkerStyle values. |
| GetState | Gets the current state of the action. |
| GetValue | Gets the current marker style of the first bullet list containing the caret/selection. |
| HasConsistentValue | Gets whether all affected blocks have the same value for this property. |
| SetValue | Sets the marker style on all bullet lists covering the selection. |
| ExecuteAsync | Executes the action asynchronously. Inherited from EditorAction. |
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.
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 bullet 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. For toggle actions, this returns a boolean. For property actions, this returns the current property value.
GetValue Method
Gets the current marker style of the first bullet 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 bullet 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
| Name | Description |
|---|---|
| DisplayName | Gets the display name for UI purposes. |
| Id | Gets the unique identifier for this action. |
| Gesture | Gets the optional keyboard gesture for this action. Inherited from EditorAction. |
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:
- Edit.Undo, Edit.Redo, Edit.Cut, etc.
- Format.RichBold, Format.RichItalic, etc.
- Paragraph.AlignLeft, Paragraph.BulletList, etc.