Stop fighting WPF editors that rewrite your markup. Drop a real WYSIWYG and HTML source editor into your C# or VB.NET WPF app from NuGet

Download Free Trial
C# & VB.NET sample projects14-day evaluation
Video Demonstration for Rational Will
Package Manager Console
PM> Install-Package SpiceLogic.HtmlEditor.WPF

Meet the WPF HTML Editor

Place the control on a XAML window and you have a working WPF HTML editor - toolbar, WYSIWYG surface, formatted source view, preview mode, context menus, dialogs, spell checking, table editing, and image insertion. It binds where WPF developers expect it to bind, themes where WPF developers expect it to theme, and ships as a single specialized control.

The 3.0 line modernizes the icon set to XAML vector paths so the toolbar stays crisp at any DPI, and adds a formatted, indented source view so the raw HTML stops being a wall of text.

SpiceLogic WPF HTML editor control hosted in a XAML window showing toolbar and three editor modes

Install in One Line with NuGet

Add the editor to your WPF project from NuGet:

PM> Install-Package SpiceLogic.HtmlEditor.WPF

Then drop it into a XAML window:

xmlns:editor="clr-namespace:SpiceLogic.HtmlEditor.WPF;assembly=SpiceLogic.HtmlEditor.WPF"
...
<editor:WpfHtmlEditor BodyHtml="..." HtmlChanged="OnHtmlChanged" />

The current line supports .NET Framework 4.5, 4.7.2, 4.8, and .NET 5 through .NET 10 on Windows, so it fits both maintained legacy WPF apps and current Windows desktop projects. License-key activation - setting WpfHtmlEditor.LicenseKey at startup - replaces the older unlocked-DLL workflow.

Visual Studio showing the WPF HTML editor installed via NuGet and instantiated in a XAML window

Modern XAML Vector Icons at Any DPI

Every toolbar button is a XAML vector path, not a PNG asset. The icon set was rebuilt in the 3.0 line and stays crisp at 100%, 125%, 150%, 175%, and 200% DPI - and on 4K monitors and per-monitor DPI configurations. The editor doesn't look like a 2010 component dropped next to your modern WPF UI.

WPF HTML editor toolbar with XAML vector icons rendered crisp at 100, 150, and 200 percent DPI

Switch Between WYSIWYG, Source, and Preview Modes

Use WYSIWYG mode when users want to compose visually. Switch to Source mode when a developer or power user needs to inspect or edit the generated HTML. Use Preview mode when the content should be rendered read-only before saving or sending.

The Source view is formatted and indented in 3.0, not a single unwrapped line of markup. Right-click anywhere in WYSIWYG and select View Source to inspect the markup behind a selection without leaving the document. In Preview mode, Ctrl-clicking a hyperlink opens it in the user's actual default browser rather than forcing legacy Internet Explorer behavior.

Formatted HTML source view in a WPF HTML editor control

Clean HTML Output, Fragment or Full Document

Some workflows need an HTML fragment. Some need a full document. The editor exposes both:

  • BodyHtml - the inner HTML of the document body, useful when you store content inside your own page, template, or database column.
  • DocumentHtml - the full HTML document including wrapper, header, and DOCTYPE, useful when you save or send standalone HTML.

HTML5 is the default document type in 3.0, with override controls available for older render targets.

BodyHtml versus DocumentHtml output options in WPF HTML editor for fragment and full document storage

Paste From Word and Outlook Without the Mess

End users paste from Word and Outlook every day. The editor auto-detects Microsoft Office clipboard content on paste and cleans it to standards-compliant XHTML automatically - no separate "Paste from Word" button to remember, no MsoNormal classes polluting the output. Set Options.AutoDetectWordPaste and it's on.

If you need a stricter cleanup policy, the Pasting event fires before clipboard content reaches the document. Inspect the HTML, modify it, replace it, or cancel the paste outright.

WPF HTML editor pasting Microsoft Word content with auto-detected clean HTML output

Insert Images From File, URL, Clipboard, or Base64

End users can insert images from a local file, an absolute URL, or directly from the clipboard. Clipboard images can be embedded as Base64 Data URIs so the HTML is self-contained, or saved to a base folder and referenced by relative path using the editor's BaseUrl.

Pasted screenshots and photos auto-resize to a sensible maximum width by default - controlled by MaxPastedImageWidth - so the document stays portable across email clients and web hosts. When you need to publish, the EmbedLocalImagesAsBase64() method walks the document and converts every local image to a Base64 Data URI in a single call.

YouTube embedding is supported through the toolbar, with the option to add ?rel=0 to keep related-videos suggestions out of the embed. Hyperlinks support cross-document bookmark targets through the hyperlink dialog.

WPF HTML editor image insertion dialog showing file URL clipboard and Base64 embedding options

Spell Check Out of the Box

The US English dictionary is embedded in the control. Drop the editor in, run the project, type a misspelling, and the red squiggle appears. No native DLLs to copy, no dictionary files to bundle into the installer for the default setup.

The engine is a pure-managed Hunspell implementation. To support additional languages, drop in any OpenOffice .dic / .aff dictionary pair. Inline and dialog-based modes are both supported, as is a per-user custom dictionary. Per-language switching at runtime is exposed through SpellCheckOption.SpellCheckLanguage.

If you already have your own spell-check engine, plug it in through ISpellCheckerEngine.

WPF HTML editor inline spell checker with red underline and OpenOffice dictionary suggestion menu

Localized Editor UI in 14 Languages

Set one property and the entire editor UI reflows:

editor.Language = EditorLanguage.German;

Every toolbar tooltip, dialog caption, dialog button, and context-menu item appears in the chosen language. Fourteen UI languages are bundled: English (US), English (UK), German, Dutch, French, Spanish, Italian, Danish, Polish, Norwegian, Czech, Swedish, Portuguese (Brazil), and Portuguese (Portugal).

UI language and spell-check language are independent: you can run a German UI with an English spell-check dictionary if your users edit English content in a German shell. UI language is set with Language; spell-check language is set with SpellCheckOption.SpellCheckLanguage.

WPF HTML editor displayed in German, French, and Spanish to demonstrate language pack switching

Customize Every Toolbar Button

Show, hide, replace, or extend any toolbar button. Build a custom button entirely from XAML or code. Override the click handler of any built-in button through ToolbarItemOverrider - useful when you want the editor's Save button to call into your application's save pipeline instead of opening a file dialog.

State-aware behavior comes for free: the SelectionChanged event and the StateQuery service report which formatting is active at the caret, so your custom toolbar buttons can highlight or disable themselves correctly without you wiring up command routing by hand.

If you want to skip the built-in toolbar entirely and build your own around the editor services, every editor operation is also exposed as a method on Editor, Formatting, Selection, and StateQuery.

WPF HTML editor toolbar with a custom Save-to-Database button alongside built-in formatting buttons

Remap Every Keyboard Shortcut

An embedded editor shouldn't fight the host application for keyboard shortcuts.

The KeyBindings manager exposes binding, unbinding, overriding, disabling, enabling, and querying for editor actions represented by EditorActionId. Thirty-five actions are covered - bold, italic, underline, cut, copy, paste, undo, redo, search, spell check, ordered and unordered list commands, alignment commands, insert commands for table, image, hyperlink, symbol, and YouTube video, font color, highlight color, indent, outdent, and more.

Use it to keep familiar shortcuts where users expect them, or to let your host application's global commands win when the editor has focus.

Code editor showing KeyBindings manager binding, overriding, and disabling editor keyboard shortcuts

Customize Every Dialog with the Included Source

The source code for every dialog - Image Insert, Hyperlink, Search, Style Builder, Symbol Picker, Table, Table Cell, YouTube Embed, and the Spell Checker - ships in the trial and product package. Even without a Source Code License, you receive every dialog's source. Restyle them, change the layout, add fields, remove fields. Then ship.

If you would rather replace a dialog entirely with your own, every dialog is fronted by an interface - IImageDialog, IHyperlinkDialog, ISearchDialog, IStyleBuilderDialog, ISymbolDialog, ITableDialog, ITableCellDialog, IYouTubeVideoInsertDialog, and ISpellCheckerDialog. Implement the interface, register your dialog, done.

The same applies to the context menu - assign your own ContextMenu through the EditorContextMenuStrip property and the editor uses it.

Default WPF HTML editor image-insertion dialog next to a custom-branded replacement dialog

Theme It with a Single ResourceDictionary

The editor uses standard WPF theming. Swap a single ResourceDictionary to retheme it - light, dark, or your own design system colors and typography. The XAML vector toolbar adapts to brushes you supply. No proprietary skin engine to learn, no theme format to bolt on. Standard WPF resource resolution, the way you already style the rest of your application.

For teams that need to retemplate dialogs end to end or align deeply with a corporate WPF design system, the Source Code License includes the full source code of the control.

WPF HTML editor displayed in three themes - default light, dark, and branded styling

Intelligent Two-Way Table Editing

Tables are where many simple HTML editors fall apart. Users insert a table, edit a few cells, and the next time they open the dialog it no longer understands what's already there.

The two-way table dialog in 3.0 reads the existing table's structure and styling back from the document - row count, column count, border style, cell padding, cell background color, cell-level styling. Users continue editing without starting over.

For code-driven workflows, Content.TableAuthoringService exposes the operations: InsertRow, InsertColumn, MergeSelectedCells, and more. Cell merging can be toggled globally through the EnableTableCellMerge option.

Two-way table editing dialog in WPF HTML editor showing current table structure

Visual CSS Style Builder, Design Time and Runtime

A GUI CSS style builder available at both design time (through the WPF property surface) and at runtime (from the editor toolbar). End users pick font, size, color, background, border, margin, and padding from familiar controls - no CSS knowledge required. The editor writes the equivalent inline or class-scoped CSS into the document.

To add your own pages to the style builder - for example, a "Corporate Branding" tab with your standard color palette - implement IEditorStylePage and decorate the form with FormSelectorPageAttribute.

Visual CSS style builder dialog with font, color, border, and spacing tabs

Mail-Merge Placeholder Support

Many business editors aren't free-form text boxes. They're template builders. Users need to insert fields like customer name, invoice number, due date, ticket ID, assigned agent, or company name.

The editor exposes mail-merge placeholders through Content.MailMerge: define the list of available fields, expose an opt-in placeholder toolbar through ShowPlaceholderToolbar, insert placeholders at the caret programmatically through InsertPlaceholder, and handle the PlaceholderInserted event when users insert one. Your back-end merge code replaces the placeholders at send time.

This is the workflow behind email templates, CRM messages, support replies, invoice notes, notification bodies, ERP letter composition, and any other document template your application needs to author.

Mail-merge placeholders inserted into an HTML template, with the merge-field dropdown open

Developer Power Features

  • Content service. Read, set, insert, transform, and export HTML through the Content service. Sub-services for MailMerge (placeholder fields) and TableAuthoringService (programmatic table operations).
  • Caret service. Get and set caret position by point or by index through the Caret service.
  • Editor commands. Cut, copy, paste, undo, redo, search, replace, print, and command execution through the Editor service.
  • Formatting service. Apply bold, italic, underline, font, colors, alignment, lists, headings, and format removal through Formatting.
  • Selection service. Read selected HTML, select text, select all, trim selections through Selection.
  • State query service. Ask whether the current selection is bold, italic, inside a table, undoable, or redoable - 37 query methods through StateQuery.
  • HTML-Changed event. HtmlChanged fires immediately when the document changes - useful for dirty-flag tracking and live preview elsewhere in the host.
  • Base64 image conversion. EmbedLocalImagesAsBase64() converts every local image in the document to a Base64 Data URI in one call.
  • Email-ready output. Content.GetEmailMessageWithLocalImagesEmbedded() returns a fully populated MailMessage with images embedded, ready to send through SMTP.
  • Enter-key behavior. Choose between paragraph (<p>) and line-break (<br>) on Enter, through EnterKeyResponse.
  • HTML5 DOCTYPE by default. Legacy DOCTYPEs available through a property toggle for older render targets.
  • License-key activation. Set WpfHtmlEditor.LicenseKey once at application startup. No license file to ship.
WPF HTML editor service-based API showing Content Caret Editor Formatting Selection and StateQuery services

Need it for WinForms?

Building a Windows Forms application instead of WPF? SpiceLogic offers a separate WinForms HTML Editor Control with its own landing page, documentation, and licensing.

The two products share design philosophy and API patterns but ship as separate controls optimized for each desktop UI stack.

Hear From Our Clients