Skip to content

Separator

Separator (NaviusSeparator) is a single self-contained lookless Control rendering a horizontal or vertical divider line. WPF’s stock Separator was rejected as a base because it has no standalone Orientation of its own (it visually adapts to a hosting ItemsControl instead), so this is a small custom control with its own Orientation dependency property.

xmlns:navius="clr-namespace:Navius.Wpf.Primitives.Controls;assembly=Navius.Wpf.Primitives"
<StackPanel>
<TextBlock Text="Section one" />
<navius:NaviusSeparator />
<TextBlock Text="Section two" />
<navius:NaviusSeparator Orientation="Vertical" Decorative="True" />
</StackPanel>
Property Type Default From Description
Orientation Orientation Horizontal NaviusSeparator Native WPF enum (Horizontal/Vertical); structurally rules out an invalid token, unlike the web contract’s runtime isValidOrientation guard.
Decorative bool false NaviusSeparator When true, removed from the accessibility tree (IsControlElementCore/IsContentElementCore both return false).

NaviusSeparatorAutomationPeer (a FrameworkElementAutomationPeer) reports AutomationControlType.Separator with an orientation-aware GetOrientationCore(). When Decorative is true, IsControlElementCore()/IsContentElementCore() both return false (combined with the base implementation, which additionally depends on UIElement.IsVisible), removing the element from the accessibility tree. The pure decorative-vs-not decision is split into a public static IsAccessibilityTreeMember(bool decorative) so it is unit-testable without a real, shown window; the unit suite (9 tests) covers both that pure logic and the “decorative always forces false” case on a real peer instance.

  • Decorative is modeled as one boolean-driven automation-peer override rather than two separate templates or peer classes, even though the web literally renders two different divs (with/ without role).
  • Orientation is the native System.Windows.Controls.Orientation enum rather than a string, which structurally obsoletes the web’s isValidOrientation invalid-token guard (an enum has no “diagonal” value to reject).
  • WPF’s stock Separator control was rejected as a base (no standalone Orientation, adapts to a hosting ItemsControl instead); this is a small custom lookless Control instead.

The Separator Gallery page rendered at the pinned commit, in each theme.

Separator Gallery page in the light theme

Separator Gallery page in the dark theme

Separator Gallery page in the high contrast theme