Other Useful Events
This page documents the secondary events on WpfHtmlEditor that are not covered by the main Useful Events page. The Useful Events page (page 142) already covers HtmlChanged, Pasting, and SelectionChanged — the document-level events most apps need first. The events listed here are scoped to element interaction, mode switching, file I/O, error reporting, status updates, and spell-check completion.
All routed events fire with bubbling routing strategy on the WpfHtmlEditor instance, so you can subscribe directly in code-behind or attach handlers in XAML using attached-event syntax. The two element-interaction events (HtmlElementClicked and HtmlElementMouseDown) are CLR events — the editor checks for subscribers before performing the per-element work, so leaving them unsubscribed costs nothing.
EditorModeChanged
Raised when the user switches between WYSIWYG, HTML source, and Preview modes from the toolbar (or when your code changes the mode programmatically). The event uses the standard WPF RoutedEventHandler signature; the current mode can be read back from WpfHtmlEditor.EditorMode.

using System.Windows;
using SpiceLogic.HtmlEditor.WPF;
editor.EditorModeChanged += (s, e) =>
{
// EditorMode is one of WysiwygMode, HtmlMode, PreviewMode.
var mode = editor.EditorMode;
statusBar.Text = $"Editor mode is now {mode}";
};ContextMenuShowing
Fires just before the editor's default right-click context menu opens. Use it to suppress the default menu (set e.Handled = true) and show your own at the location reported by the event args.
Event args: ContextMenuShowingEventArgs
- Point OffsetMousePosition — Mouse position relative to the editor surface, suitable for placing a custom menu via ContextMenu.PlacementRectangle or by translating to screen coordinates.

using SpiceLogic.HtmlEditor.WPF.EditorEventArgs;
editor.ContextMenuShowing += (s, e) =>
{
// Suppress the built-in menu and show your own at the click location.
e.Handled = true;
var menu = (ContextMenu)Resources["MyEditorContextMenu"];
menu.PlacementTarget = editor;
menu.Placement = System.Windows.Controls.Primitives.PlacementMode.Relative;
menu.HorizontalOffset = e.OffsetMousePosition.X;
menu.VerticalOffset = e.OffsetMousePosition.Y;
menu.IsOpen = true;
};HtmlElementClicked
Fires when the user clicks any HTML element inside the editor. Filter to the element types you care about by setting Last updated on May 12, 2026