In my WPF menu I have a separator (System.Windows.Controls.Separator) item that seems to invisibly accept focus when navigating the menu via the arrow keys. I’d like the arrow navigation path to skip these separators. I’ve tried setting IsEnabled and IsTabStop are set to false, but neither of these seem to have any effect.
In XAML, how can I specify that separator items should be skipped?
UPDATE: Here’s the currently style XAML for my separator:
<Style TargetType="{x:Type Separator}">
<Setter Property="Focusable" Value="false" />
<Setter Property="SnapsToDevicePixels" Value="true" />
<Setter Property="IsTabStop" Value="false" />
<Setter Property="IsHitTestVisible" Value="false" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type Separator}">
<Border BorderThickness="1"
Margin="10,5,10,5">
<Border.BorderBrush>
<LinearGradientBrush StartPoint="0.5,0" EndPoint="0.5,1" >
<GradientStop Color="{DynamicResource Nui10Color}" Offset="0"/>
<GradientStop Color="{DynamicResource Nui50Color}" Offset="1"/>
</LinearGradientBrush>
</Border.BorderBrush>
</Border>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
I figured it out. I needed to set Focusable on the MenuItem itself, not the template: