Editor service

    Control editing commands, clipboard operations, history, search, scrolling and printing through an awaited facade. The current view supplies its own history and selection.

    The facade is available as editor.Editor; 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

    Run commands on the UI thread after readiness. Read-only state, selection changes and document ownership are checked at application boundaries; handle rejected or cancelled operations in your host.

    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.

    bool canUndo = await editor.StateQuery.CanUndoAsync();
    if (canUndo) await editor.Editor.UndoAsync();

    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
    ClearUndoStackAsyncTask ClearUndoStackAsync(CancellationToken cancellationToken)
    CopyAsyncTask CopyAsync(CancellationToken cancellationToken)
    CutAsyncTask CutAsync(CancellationToken cancellationToken)
    DeleteAsyncTask DeleteAsync(CancellationToken cancellationToken)
    DeleteTextAsyncTask DeleteTextAsync(int startIndex, int length, CancellationToken cancellationToken)
    FocusAsyncTask<bool> FocusAsync(CancellationToken cancellationToken)
    GetScrollBarSettingAsyncTask<ScrollBarVisibility> GetScrollBarSettingAsync(CancellationToken cancellationToken)
    GetScrollPositionAsyncTask<Point> GetScrollPositionAsync(CancellationToken cancellationToken)
    GetScrollStateAsyncTask<EditorScrollState> GetScrollStateAsync(CancellationToken cancellationToken)
    JustifyCenterAsyncTask JustifyCenterAsync(CancellationToken cancellationToken)
    JustifyLeftAsyncTask JustifyLeftAsync(CancellationToken cancellationToken)
    JustifyRightAsyncTask JustifyRightAsync(CancellationToken cancellationToken)
    PasteAsyncTask PasteAsync(CancellationToken cancellationToken)
    PasteFromMsWordAsyncTask PasteFromMsWordAsync(CancellationToken cancellationToken)
    PrintAsyncTask PrintAsync(CancellationToken cancellationToken)
    RedoAsyncTask RedoAsync(CancellationToken cancellationToken)
    ReplaceAllAsyncTask<int> ReplaceAllAsync(string replaceWhat, string replaceWith, bool matchWholeWord, bool matchCase, CancellationToken cancellationToken)
    ReplaceAsyncTask<bool> ReplaceAsync(string searchString, string replacement, bool matchWholeWord, bool matchCase, CancellationToken cancellationToken)
    ReplaceTextAsyncTask ReplaceTextAsync(int startIndex, int length, string replacementText, CancellationToken cancellationToken)
    SearchAsyncTask<bool> SearchAsync(string text, bool forward, bool matchWholeWord, bool matchCase, CancellationToken cancellationToken)
    SetScrollBarSettingAsyncTask SetScrollBarSettingAsync(ScrollBarVisibility scrollbarValue, CancellationToken cancellationToken)
    SetScrollPositionAsyncTask SetScrollPositionAsync(int x, int y, CancellationToken cancellationToken)
    ShowPrintPreviewDialogAsyncTask ShowPrintPreviewDialogAsync(CancellationToken cancellationToken)
    ShowSearchDialogAsyncTask ShowSearchDialogAsync(CancellationToken cancellationToken)
    UnFocusAsyncTask UnFocusAsync(CancellationToken cancellationToken)
    UndoAsyncTask UndoAsync(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.