Skip to content

SplitButton

SplitButton fuses a primary action button to a chevron that opens a dropdown, sharing one hairline border and one outer corner-radius envelope split by a single vertical divider. The dropdown is a NaviusMenuPopup from Navius.Wpf.Primitives’ Menu family, opened by an embedded NaviusMenuTrigger template part (PART_Chevron): this control consumes that primitive’s existing open/close/ placement logic as-is rather than reimplementing it, only re-skinning the trigger’s chrome locally (flush-right corners, no left border) to fuse visually with the primary segment (PART_Primary).

xmlns:splitButton="clr-namespace:Navius.Wpf.Ui.SplitButton;assembly=Navius.Wpf.Ui"
xmlns:menu="clr-namespace:Navius.Wpf.Primitives.Controls.Menus;assembly=Navius.Wpf.Primitives"
<!-- also merge Themes/SplitButton.xaml AND Navius.Wpf.Primitives' Themes/Menu.xaml, since the
dropdown content is a NaviusMenuPopup of NaviusMenuItem rows styled by that dictionary -->
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="pack://application:,,,/Navius.Wpf.Ui;component/Themes/SplitButton.xaml" />
<ResourceDictionary Source="pack://application:,,,/Navius.Wpf.Primitives;component/Themes/Menu.xaml" />
</ResourceDictionary.MergedDictionaries>
<splitButton:NaviusSplitButton Content="Save" Click="OnSave">
<splitButton:NaviusSplitButton.Menu>
<menu:NaviusMenuPopup MinWidth="180">
<menu:NaviusMenuItem Header="Save as..." />
<menu:NaviusMenuItem Header="Save a copy" />
</menu:NaviusMenuPopup>
</splitButton:NaviusSplitButton.Menu>
</splitButton:NaviusSplitButton>
Property Type Default From Description
Command ICommand? null NaviusSplitButton Bound to PART_Primary; invoked when the primary segment is clicked.
CommandParameter object? null NaviusSplitButton Passed to Command.
CommandTarget IInputElement? null NaviusSplitButton Passed to Command.
Menu NaviusMenuPopup? null NaviusSplitButton The dropdown opened by the chevron. Build it exactly like a NaviusMenuTrigger.Menu (NaviusMenuItem children).
Content object - ContentControl The primary segment’s label.
Event Signature Fires when
Click RoutedEventHandler PART_Primary (the primary segment, not the chevron) is clicked. Wired in OnApplyTemplate to the primary part’s native Click and re-raised as this control’s own bubbling Click event.
Key Behavior
Space / Enter (primary segment focused) Native ButtonBase activation of PART_Primary, raising Click and executing Command.
Space / Enter (chevron focused) Opens the dropdown, native NaviusMenuTrigger/ContextMenu behavior.
Arrow keys (dropdown open) Native menu-item navigation within the open NaviusMenuPopup, unrelated to this control’s own code.
Escape / outside click (dropdown open) Closes the dropdown, native ContextMenu dismissal.

NaviusSplitButton itself derives ContentControl and overrides no CreateAutomationPeer, so it ships no custom peer for the composite as a whole. PART_Primary is a plain Button, carrying native ButtonAutomationPeer behavior (Invoke pattern). PART_Chevron is a NaviusMenuTrigger (a ToggleButton subclass from Navius.Wpf.Primitives), carrying native ToggleButton automation behavior plus the Menu family’s own NaviusMenuPopup/NaviusMenuItem automation, none of it authored in this family. The M6 audit confirmed the two template parts agree with the C#: PART_Primary is retrieved in OnApplyTemplate (NaviusSplitButton.cs:90) and both x:Names exist in Themes/SplitButton.xaml (lines 113, 125); PART_Chevron is consumed declaratively and correctly not retrieved in C#. The unit suite exercises PART_Primary.Click re-raising this control’s Click event against a themed instance (SplitButton_ClickEvent_RaisesOnPrimaryButtonClick) and the no-command/no-menu defaults.