Setting editor border
The WPF HTML Editor draws a plain default border around its editing surface, but your application may need that border to say more: a red outline when a field fails validation, a highlighted border while the control has focus, or just a color and thickness that matches the rest of your form instead of the editor's stock look. The WpfHtmlEditor exposes two dependency properties that control the border drawn around the editing surface:
EditorBorderColor- typeSystem.Windows.Media.Color. The color of the border around the editing surface.EditorBorderWidth- typeSystem.Windows.Thickness. The per-side width of the border, exactly like a WPFMargin.
A common use is to change the color and width conditionally, for example to make an entry stand out visually when it is flagged as critical.

Set EditorBorderColor="Red" and EditorBorderWidth="4" as XAML literals for a fixed border, or bind both properties to view-model state to change it dynamically:
<wpf:WpfHtmlEditor x:Name="editor" EditorBorderColor="{Binding EntryBorderColor}" EditorBorderWidth="{Binding EntryBorderThickness}" />The bound properties compute their value from a boolean flag:
public Color EntryBorderColor => IsCriticalFault ? Color.FromRgb(0xCC, 0x00, 0x00) // bay-warning red : Color.FromRgb(0xCC, 0xCC, 0xCC); // neutral grey public Thickness EntryBorderThickness => IsCriticalFault ? new Thickness(4) // shout : new Thickness(1); // quietReturn _When the flag changes, PropertyChanged fires and the editor redraws automatically, no code-behind needed.
To hide the border, for example inside an already-bordered container, set the width to a zero Thickness:
<wpf:WpfHtmlEditor x:Name="summaryEditor" EditorBorderWidth="0" />From code-behind that's:
summaryEditor.EditorBorderWidth = new Thickness(0);summaryEditor.EditorBorderWidth = New Thickness(0)Both properties can also be set directly from code-behind, for example to highlight an editor after a diagnostic check fails:
using System.Windows; using System.Windows.Media; private void OnDiagnosticFailed() { editor.EditorBorderColor = Color.FromRgb(0xCC, 0x00, 0x00); editor.EditorBorderWidth = new Thickness(4); }Imports System.Windows Imports System.Windows.Media End Sub Private Sub OnDiagnosticFailed() editor.EditorBorderColor = Color.FromRgb(&HCC, &H00, &H00) editor.EditorBorderWidth = New Thickness(4)