Skip to main content

IToggleAction Interface

Definition

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

Represents an action that has an on/off state.

public interface IToggleAction
Implements:IEditorAction

Remarks

Toggle actions are used for formatting commands like RichBold, RichItalic, and RichUnderline. The Avalonia.Controls.Documents.Primitives.Actions.IToggleAction.IsChecked(Avalonia.Controls.Documents.Primitives.ITextEditorHost) property reflects whether the formatting is currently applied to the selection.

Methods

NameDescription
IsCheckedGets whether the action is currently "on" for the selection.

IsChecked Method

Gets whether the action is currently "on" for the selection.

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

Parameters

host Avalonia.Controls.Documents.Primitives.ITextEditorHost

The editor host to query.

Returns

bool

True if the toggle state is on; otherwise, false.

Remarks

For formatting actions, this returns true if all text in the selection has the formatting applied.