Formatting service

    Apply character and paragraph formatting to the current editor selection. Use these operations for application-owned formatting controls.

    The facade is available as editor.Formatting; its interface can be replaced by an application implementation.

    Actual Avalonia editor showing the document and native authoring controls.
    Actual Avalonia editor showing the document and native authoring controls.

    Use it in your application

    Formatting requires an appropriate editable selection or caret. Source mode supports the documented literal wrapping and insertion adaptations; it is not a hidden Design selection.

    All examples assume an editor named editor, already attached to a visible window, and an awaited editor.Ready. Keep operations asynchronous instead of blocking the UI thread.

    await editor.Formatting.BoldAsync();
    await editor.Formatting.ChangeFontSizeAsync("12pt");

    Members

    These signatures come from the delivered 1.0.2 assemblies and XML documentation. Cancellation tokens can be supplied to awaited operations. Follow the source-specific notes above when adapting a WPF integration.

    MemberSignature
    AlignCenterAsyncTask AlignCenterAsync(CancellationToken cancellationToken)
    AlignLeftAsyncTask AlignLeftAsync(CancellationToken cancellationToken)
    AlignRightAsyncTask AlignRightAsync(CancellationToken cancellationToken)
    ApplyListAsyncTask ApplyListAsync(ListTypes listType, FormatOptions option, CancellationToken cancellationToken)
    ApplyTitleHeaderAsyncTask ApplyTitleHeaderAsync(int headerNumber, CancellationToken cancellationToken)
    BoldAsyncTask BoldAsync(FormatOptions option, CancellationToken cancellationToken)
    ChangeFontAsyncTask ChangeFontAsync(string fontFamilyName, string fontSize, Color foreColor, CancellationToken cancellationToken)
    ChangeFontNameAsyncTask ChangeFontNameAsync(string fontFamilyName, CancellationToken cancellationToken)
    ChangeFontSizeAsyncTask ChangeFontSizeAsync(string fontSize, CancellationToken cancellationToken)
    ChangeForeColorAsyncTask ChangeForeColorAsync(Color foreColor, CancellationToken cancellationToken)
    ChangeHighlightColorAsyncTask ChangeHighlightColorAsync(Color highlightColor, CancellationToken cancellationToken)
    IndentAsyncTask IndentAsync(CancellationToken cancellationToken)
    ItalicAsyncTask ItalicAsync(FormatOptions option, CancellationToken cancellationToken)
    OutdentAsyncTask OutdentAsync(CancellationToken cancellationToken)
    RemoveAlignmentAsyncTask RemoveAlignmentAsync(CancellationToken cancellationToken)
    RemoveFormatAllAsyncTask RemoveFormatAllAsync(CancellationToken cancellationToken)
    RemoveFormatFromSelectionAsyncTask RemoveFormatFromSelectionAsync(CancellationToken cancellationToken)
    RemoveHeaderTitleAsyncTask RemoveHeaderTitleAsync(CancellationToken cancellationToken)
    StrikeThroughAsyncTask StrikeThroughAsync(FormatOptions option, CancellationToken cancellationToken)
    SubscriptAsyncTask SubscriptAsync(FormatOptions option, CancellationToken cancellationToken)
    SuperscriptAsyncTask SuperscriptAsync(FormatOptions option, CancellationToken cancellationToken)
    UnderlineAsyncTask UnderlineAsync(FormatOptions option, CancellationToken cancellationToken)

    Continue with

    Last updated on Oct 18, 2026

    Put this into practice.

    Start with the C# Avalonia sample. Restore this edition's package and install the native browser prerequisites before running it.

    Prefer a guided look? Book a free live demo with our engineers - live on Zoom or Teams, never a chatbot.