Skip to main content

EditorActions Class

Definition

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

Provides singleton instances of all built-in editor actions.

public class EditorActions

Inheritance: object -> EditorActions

Remarks

Actions are organized by category:

  • Edit actions: Undo, Redo, Cut, Copy, Paste, SelectAll
  • Format actions: RichBold, RichItalic, RichUnderline, Strikethrough, RichSuperscript, RichSubscript
  • Font actions: FontFamily, FontSize, ForegroundColor, BackgroundColor

Use these instances in XAML with {x:Static editor:EditorActions.RichBold} or access them from code via EditorActions.RichBold.

Methods

NameDescription
GetByIdGets an action by its unique identifier.

GetById Method

Gets an action by its unique identifier.

public Avalonia.Controls.Documents.Primitives.Actions.IEditorAction GetById(string id)

Parameters

id string

The action ID (e.g., "Format.RichBold").

Returns

Avalonia.Controls.Documents.Primitives.Actions.IEditorAction

The action if found; otherwise, null.

Properties

NameDescription
AlignCenterGets the Align Center action.
AlignJustifyGets the Justify action.
AlignLeftGets the Align Left action.
AlignRightGets the Align Right action.
AllGets all built-in actions.
BackgroundColorGets the Background Color action.
BlockBackgroundGets the Block Background action for block elements.
BlockBorderGets the Block Border toggle action.
BoldGets the RichBold action.
BorderBrushGets the Border Brush (color) action for block elements.
BorderThicknessGets the Border Thickness action for block elements.
BulletMarkerStyleGets the Bullet Marker Style action (changes marker symbol on bullet lists).
CopyGets the Copy action.
CutGets the Cut action.
DeleteColumnGets the Delete Column action.
DeleteRowGets the Delete Row action.
DeleteTableGets the Delete Table action.
FontFamilyGets the Font Family action.
FontSizeGets the Font Size action.
ForegroundColorGets the Foreground Color action.
InsertColumnAfterGets the Insert Column After action.
InsertColumnBeforeGets the Insert Column Before action.
InsertRowAfterGets the Insert Row After action.
InsertRowBeforeGets the Insert Row Before action.
InsertTableGets the Insert Table action.
ItalicGets the RichItalic action.
LineHeightGets the Line Height action.
MarginGets the Margin action for block elements.
NumberedMarkerStyleGets the Numbered Marker Style action (changes marker symbol on numbered lists).
PaddingGets the Padding action for block elements.
PasteGets the Paste action.
PasteUnformattedGets the Paste Without Formatting action (Ctrl+Shift+V).
RedoGets the Redo action.
SelectAllGets the Select All action.
StrikethroughGets the Strikethrough action.
SubscriptGets the RichSubscript action.
SuperscriptGets the RichSuperscript action.
TextAlignmentActionGets the Text Alignment action (Left, Center, Right, Justify).
ToggleBulletListGets the Toggle Bullet List action (wraps/unwraps paragraphs as an unordered list).
ToggleNumberedListGets the Toggle Numbered List action (wraps/unwraps paragraphs as an ordered list).
UnderlineGets the RichUnderline action.
UndoGets the Undo action.

AlignCenter Property

Gets the Align Center action.

public Avalonia.Controls.Documents.Primitives.Actions.IEditorAction AlignCenter { get; set; }

AlignJustify Property

Gets the Justify action.

public Avalonia.Controls.Documents.Primitives.Actions.IEditorAction AlignJustify { get; set; }

AlignLeft Property

Gets the Align Left action.

public Avalonia.Controls.Documents.Primitives.Actions.IEditorAction AlignLeft { get; set; }

AlignRight Property

Gets the Align Right action.

public Avalonia.Controls.Documents.Primitives.Actions.IEditorAction AlignRight { get; set; }

All Property

Gets all built-in actions.

public System.Collections.Generic.IEnumerable<Avalonia.Controls.Documents.Primitives.Actions.IEditorAction> All { get; set; }

BackgroundColor Property

Gets the Background Color action.

public Avalonia.Controls.Documents.Primitives.Actions.IEditorAction BackgroundColor { get; set; }

BlockBackground Property

Gets the Block Background action for block elements.

public Avalonia.Controls.Documents.Primitives.Actions.IEditorAction BlockBackground { get; set; }

Remarks

Sets the background color for entire paragraphs or sections. Works with Avalonia.Controls.Documents.Primitives.Toolbar.ColorPickerTool for color selection.

Different from inline text background (RichRun.Background) - fills the entire block area including padding.

Combine with Padding and BorderBrush to create callout boxes.

BlockBorder Property

Gets the Block Border toggle action.

public Avalonia.Controls.Documents.Primitives.Actions.IEditorAction BlockBorder { get; set; }

Bold Property

Gets the RichBold action.

public Avalonia.Controls.Documents.Primitives.Actions.IEditorAction Bold { get; set; }

BorderBrush Property

Gets the Border Brush (color) action for block elements.

public Avalonia.Controls.Documents.Primitives.Actions.IEditorAction BorderBrush { get; set; }

Remarks

Sets the border color for paragraphs or sections. Works with Avalonia.Controls.Documents.Primitives.Toolbar.ColorPickerTool for color selection.

Note: Border won't be visible without also setting BorderThickness (width). Combine with BlockBackground and Padding to create outlined callout boxes.

BorderThickness Property

Gets the Border Thickness action for block elements.

public Avalonia.Controls.Documents.Primitives.Actions.IEditorAction BorderThickness { get; set; }

Remarks

Sets uniform border thickness (width) on all four sides. Common values: 0, 1, 2, 3 pixels.

Note: Border won't be visible without also setting BorderBrush (color). For non-uniform borders, use a dedicated border editor panel.

BulletMarkerStyle Property

Gets the Bullet Marker Style action (changes marker symbol on bullet lists).

public Avalonia.Controls.Documents.Primitives.Actions.IEditorAction BulletMarkerStyle { get; set; }

Copy Property

Gets the Copy action.

public Avalonia.Controls.Documents.Primitives.Actions.IEditorAction Copy { get; set; }

Cut Property

Gets the Cut action.

public Avalonia.Controls.Documents.Primitives.Actions.IEditorAction Cut { get; set; }

DeleteColumn Property

Gets the Delete Column action.

public Avalonia.Controls.Documents.Primitives.Actions.IEditorAction DeleteColumn { get; set; }

DeleteRow Property

Gets the Delete Row action.

public Avalonia.Controls.Documents.Primitives.Actions.IEditorAction DeleteRow { get; set; }

DeleteTable Property

Gets the Delete Table action.

public Avalonia.Controls.Documents.Primitives.Actions.IEditorAction DeleteTable { get; set; }

FontFamily Property

Gets the Font Family action.

public Avalonia.Controls.Documents.Primitives.Actions.IEditorAction FontFamily { get; set; }

FontSize Property

Gets the Font Size action.

public Avalonia.Controls.Documents.Primitives.Actions.IEditorAction FontSize { get; set; }

ForegroundColor Property

Gets the Foreground Color action.

public Avalonia.Controls.Documents.Primitives.Actions.IEditorAction ForegroundColor { get; set; }

InsertColumnAfter Property

Gets the Insert Column After action.

public Avalonia.Controls.Documents.Primitives.Actions.IEditorAction InsertColumnAfter { get; set; }

InsertColumnBefore Property

Gets the Insert Column Before action.

public Avalonia.Controls.Documents.Primitives.Actions.IEditorAction InsertColumnBefore { get; set; }

InsertRowAfter Property

Gets the Insert Row After action.

public Avalonia.Controls.Documents.Primitives.Actions.IEditorAction InsertRowAfter { get; set; }

InsertRowBefore Property

Gets the Insert Row Before action.

public Avalonia.Controls.Documents.Primitives.Actions.IEditorAction InsertRowBefore { get; set; }

InsertTable Property

Gets the Insert Table action.

public Avalonia.Controls.Documents.Primitives.Actions.IEditorAction InsertTable { get; set; }

Italic Property

Gets the RichItalic action.

public Avalonia.Controls.Documents.Primitives.Actions.IEditorAction Italic { get; set; }

LineHeight Property

Gets the Line Height action.

public Avalonia.Controls.Documents.Primitives.Actions.IEditorAction LineHeight { get; set; }

Remarks

Line height is a block-level property that controls vertical spacing between lines. Important: Uses absolute pixel/point values, not relative multipliers.

Common values: 14, 16, 18, 20, 24, 28, 32 pixels.

Margin Property

Gets the Margin action for block elements.

public Avalonia.Controls.Documents.Primitives.Actions.IEditorAction Margin { get; set; }

Remarks

Sets uniform margin (spacing outside the block) on all four sides. Common values: 0, 5, 10, 15, 20 pixels.

For non-uniform margins, use a dedicated margin editor panel.

NumberedMarkerStyle Property

Gets the Numbered Marker Style action (changes marker symbol on numbered lists).

public Avalonia.Controls.Documents.Primitives.Actions.IEditorAction NumberedMarkerStyle { get; set; }

Padding Property

Gets the Padding action for block elements.

public Avalonia.Controls.Documents.Primitives.Actions.IEditorAction Padding { get; set; }

Remarks

Sets uniform padding (spacing inside the block, between border and content) on all four sides. Common values: 0, 5, 10, 15, 20 pixels.

Useful when combined with borders or backgrounds to create callout boxes. For non-uniform padding, use a dedicated padding editor panel.

Paste Property

Gets the Paste action.

public Avalonia.Controls.Documents.Primitives.Actions.IEditorAction Paste { get; set; }

PasteUnformatted Property

Gets the Paste Without Formatting action (Ctrl+Shift+V).

public Avalonia.Controls.Documents.Primitives.Actions.IEditorAction PasteUnformatted { get; set; }

Redo Property

Gets the Redo action.

public Avalonia.Controls.Documents.Primitives.Actions.IEditorAction Redo { get; set; }

SelectAll Property

Gets the Select All action.

public Avalonia.Controls.Documents.Primitives.Actions.IEditorAction SelectAll { get; set; }

Strikethrough Property

Gets the Strikethrough action.

public Avalonia.Controls.Documents.Primitives.Actions.IEditorAction Strikethrough { get; set; }

Subscript Property

Gets the RichSubscript action.

public Avalonia.Controls.Documents.Primitives.Actions.IEditorAction Subscript { get; set; }

Superscript Property

Gets the RichSuperscript action.

public Avalonia.Controls.Documents.Primitives.Actions.IEditorAction Superscript { get; set; }

TextAlignmentAction Property

Gets the Text Alignment action (Left, Center, Right, Justify).

public Avalonia.Controls.Documents.Primitives.Actions.IEditorAction TextAlignmentAction { get; set; }

Remarks

Text alignment is a block-level property that applies to paragraphs and sections. When applied to a selection spanning multiple paragraphs, all affected paragraphs will have their alignment set to the specified value.

ToggleBulletList Property

Gets the Toggle Bullet List action (wraps/unwraps paragraphs as an unordered list).

public Avalonia.Controls.Documents.Primitives.Actions.IEditorAction ToggleBulletList { get; set; }

ToggleNumberedList Property

Gets the Toggle Numbered List action (wraps/unwraps paragraphs as an ordered list).

public Avalonia.Controls.Documents.Primitives.Actions.IEditorAction ToggleNumberedList { get; set; }

Underline Property

Gets the RichUnderline action.

public Avalonia.Controls.Documents.Primitives.Actions.IEditorAction Underline { get; set; }

Undo Property

Gets the Undo action.

public Avalonia.Controls.Documents.Primitives.Actions.IEditorAction Undo { get; set; }