State query service

    Query current formatting, selection capabilities and document context. Use the result to reflect editor state in native application controls.

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

    A query is a current observation, not a lock on the document. Recheck command capability when the action runs and coalesce frequent selection-driven refreshes.

    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.

    commandButton.IsEnabled = await editor.StateQuery.CanUndoAsync();
    bool bold = await editor.StateQuery.IsBoldAsync();

    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
    CanCopyAsyncTask<bool> CanCopyAsync(CancellationToken cancellationToken)
    CanCutAsyncTask<bool> CanCutAsync(CancellationToken cancellationToken)
    CanDeleteAsyncTask<bool> CanDeleteAsync(CancellationToken cancellationToken)
    CanMergeTableCellsAsyncTask<bool> CanMergeTableCellsAsync(CancellationToken cancellationToken)
    CanRedoAsyncTask<bool> CanRedoAsync(CancellationToken cancellationToken)
    CanUndoAsyncTask<bool> CanUndoAsync(CancellationToken cancellationToken)
    GetActiveFontFamilyNameAsyncTask<string> GetActiveFontFamilyNameAsync(CancellationToken cancellationToken)
    GetActiveFontSizeAsyncTask<string> GetActiveFontSizeAsync(CancellationToken cancellationToken)
    GetActiveForeColorAsyncTask<Color> GetActiveForeColorAsync(CancellationToken cancellationToken)
    GetActiveForeColorCssAsyncTask<string> GetActiveForeColorCssAsync(CancellationToken cancellationToken)
    GetActiveHighlightColorAsyncTask<Color> GetActiveHighlightColorAsync(CancellationToken cancellationToken)
    GetActiveHighlightColorCssAsyncTask<string> GetActiveHighlightColorCssAsync(CancellationToken cancellationToken)
    GetSnapshotAsyncTask<EditorSnapshot> GetSnapshotAsync(CancellationToken cancellationToken)
    IsBoldAsyncTask<bool> IsBoldAsync(CancellationToken cancellationToken)
    IsHyperLinkAsyncTask<bool> IsHyperLinkAsync(CancellationToken cancellationToken)
    IsImageAsyncTask<bool> IsImageAsync(CancellationToken cancellationToken)
    IsItalicAsyncTask<bool> IsItalicAsync(CancellationToken cancellationToken)
    IsJustifyCenterAsyncTask<bool> IsJustifyCenterAsync(CancellationToken cancellationToken)
    IsJustifyLeftAsyncTask<bool> IsJustifyLeftAsync(CancellationToken cancellationToken)
    IsJustifyRightAsyncTask<bool> IsJustifyRightAsync(CancellationToken cancellationToken)
    IsOrderedListAsyncTask<bool> IsOrderedListAsync(CancellationToken cancellationToken)
    IsStrikeThroughAsyncTask<bool> IsStrikeThroughAsync(CancellationToken cancellationToken)
    IsSubscriptAsyncTask<bool> IsSubscriptAsync(CancellationToken cancellationToken)
    IsSuperscriptAsyncTask<bool> IsSuperscriptAsync(CancellationToken cancellationToken)
    IsTableAsyncTask<bool> IsTableAsync(CancellationToken cancellationToken)
    IsTableCellAsyncTask<bool> IsTableCellAsync(CancellationToken cancellationToken)
    IsUnderlineAsyncTask<bool> IsUnderlineAsync(CancellationToken cancellationToken)
    IsUnorderedListAsyncTask<bool> IsUnorderedListAsync(CancellationToken cancellationToken)
    IsYouTubeVideoAsyncTask<bool> IsYouTubeVideoAsync(CancellationToken cancellationToken)
    QueryCommandStateAsyncTask<bool> QueryCommandStateAsync(string commandName, CancellationToken cancellationToken)
    QueryCommandValueAsyncTask<string> QueryCommandValueAsync(string commandName, 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.