Skip to main content

BlockBackgroundAction Class

Definition

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

Action for setting background color on block elements (Paragraph, Section, etc.).

public class BlockBackgroundAction

Inheritance: BlockPropertyAction<IBrush> -> BlockBackgroundAction

Remarks

Block background is different from inline text background (RichRun.Background). It fills the entire block area including padding, making it useful for:

  • Highlighting important paragraphs
  • Creating visual separation between sections
  • Building callout boxes and notes
  • Color-coding content

This action is designed to work with Avalonia.Controls.Documents.Primitives.Toolbar.ColorPickerTool. It returns null for available values, indicating the UI should use a color picker instead of a dropdown with predefined values.

When applied to a selection spanning multiple paragraphs, all affected paragraphs will have their background set to the specified color.

Tip: Combine with Avalonia.Controls.Documents.Primitives.Actions.PaddingAction and Avalonia.Controls.Documents.Primitives.Actions.BorderBrushAction to create visually distinct content blocks.

Constructors

NameDescription
BlockBackgroundActionNo summary available.

BlockBackgroundAction Constructor

public BlockBackgroundAction()

Methods

NameDescription
GetAvailableValuesNo summary available.

GetAvailableValues Method

public System.Collections.Generic.IEnumerable<Avalonia.Media.IBrush> GetAvailableValues()

Returns

System.Collections.Generic.IEnumerable<Avalonia.Media.IBrush>

Properties

NameDescription
DisplayNameNo summary available.
GestureNo summary available.
IdNo summary available.

DisplayName Property

public string DisplayName { get; set; }

Gesture Property

public Avalonia.Input.KeyGesture Gesture { get; set; }

Id Property

public string Id { get; set; }