Editor events

    Respond to accepted document changes, selection, mode transitions, file operations and authoring dialogs. Events let the host maintain save prompts and application state.

    HTML element notifications carry passive snapshots rather than a live COM DOM object.

    Avalonia HTML Editor with complete native toolbars and a readable project update document.
    Avalonia HTML Editor with complete native toolbars and a readable project update document.

    Use it in your application

    Use HtmlChanged for a host-owned dirty indicator and SelectionChanged for coalesced state refresh. File and mode events report acknowledged operations.

    Pasting is synchronous policy inspection. Do not start asynchronous mutation from that checkpoint and assume it ran before the paste.

    BrowserSessionRestored means the browser session was recreated and its previous undo history is unavailable. Keep the application document and save policy authoritative.

    editor.HtmlChanged += (_, _) => errorMessage.Text = "Document has unsaved changes.";
    editor.SelectionChanged += (_, _) => commandButton.IsEnabled = !editor.IsReadOnly;
    

    Members

    These declarations come from the package's own XML documentation. Await operations and supply cancellation tokens where your application needs them.

    BrowserSessionRestored Event

    Raised when a recreated browser has restored the last accepted document. Its previous undo history is no longer available.

    Syntax
    event EventHandler BrowserSessionRestored
    

    ContextMenuShowing Event

    Raised before opening a document menu. Cancel it, replace its ContextMenu, or customize named items.

    Syntax
    event ContextMenuShowingEventHandler ContextMenuShowing
    

    DialogOpening Event

    Raised before a built-in authoring dialog is shown. Applications may customize it.

    Syntax
    event EventHandler<EditorDialogEventArgs> DialogOpening
    

    EditorModeChanged Event

    Raised on the UI thread after an actual acknowledged mode change and surface synchronization.

    Syntax
    event EventHandler<EditorModeChangedEventArgs> EditorModeChanged
    

    Same-mode requests and failed transitions do not notify. Arguments describe the committed transition even when a listener requests another mode.

    ErrorOccurred Event

    Reports a failed native or browser operation without closing the host.

    Syntax
    event EventHandler<EditorErrorEventArgs> ErrorOccurred
    

    FileOpened Event

    Raised on the UI thread after an explicit file load is acknowledged.

    Syntax
    event EventHandler<FileEventArgs> FileOpened
    

    Canceled pickers, failed reads and ordinary HTML property assignments do not notify.

    FileSaved Event

    Raised on the UI thread after an explicit HTML file save commits atomically.

    Syntax
    event EventHandler<FileEventArgs> FileSaved
    

    Canceled pickers and failed writes do not notify. A handler exception cannot undo or fail a completed write.

    HtmlChanged Event

    Raised when accepted body or document markup changes.

    Syntax
    event EventHandler HtmlChanged
    

    HtmlElementClicked Event

    Raised on the UI thread after a filtered document click in Design or Preview.

    Syntax
    event EventHandler<HtmlElementClickedEventArgs> HtmlElementClicked
    

    Uses copied passive actual-target data and this editor as sender. Matching ancestry follows the canonical filter; All and Other select all body descendants. Native transport is asynchronous and cannot cancel browser input. Source never notifies. After changing an unnotified filter, await SynchronizeOptionsAsync.

    HtmlElementMouseDown Event

    Raised on the UI thread after a filtered document mouse-down in Design or Preview.

    Syntax
    event EventHandler<HtmlElementClickedEventArgs> HtmlElementMouseDown
    

    Uses the same copied data, ancestry filtering, owner checks and asynchronous boundary as HtmlElementClicked. Read-only rendered views still notify.

    LicenseStatusChanged Event

    Raised after license validation updates this control's editing availability.

    Syntax
    event EventHandler LicenseStatusChanged
    

    LinkClicked Event

    Reports safe link activation in preview or read-only mode without navigating the editor.

    Syntax
    event EventHandler<LinkClickedEventArgs> LinkClicked
    

    Pasting Event

    Raised synchronously on the UI thread before paste insertion or bitmap import.

    Syntax
    event EventHandler<PastingHtmlEventArgs> Pasting
    

    Inspectable HTML permits bounded replacement. Bitmap and internal ordinary paste expose cancellation only. Listener failures abort the paste; changing the document, selection, mode or relevant options invalidates its original owner.

    SelectionChanged Event

    Raised after an accepted document selection update.

    Syntax
    event EventHandler SelectionChanged
    

    SpellCheckCompleted Event

    Raised on the UI thread when an actual inline spelling pass or interactive review completes or is canceled.

    Syntax
    event EventHandler<SpellCheckCompletedEventArgs> SpellCheckCompleted
    

    Incomplete dialog closure reports Canceled. Obsolete document sessions do not publish completion for a replacement document.

    Related guides

    Last updated on Oct 30, 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.