I have the following NavBar, with the Content
data template marked up as follows:
<dxn:NavBarControl Name="SideMenuNavBar" DataContext="{Binding}" IsEnabled="{Binding Enabled}" ItemsSource="{Binding Bars}" HorizontalAlignment="Left" VerticalAlignment="Stretch" Margin="1">
<dxn:NavBarControl.Resources>
<Style TargetType="dxn:NavBarGroup">
<Setter Property="Header" Value="{Binding DisplayText}"/>
<Setter Property="Content" Value="{Binding MenuItems}"/>
<Setter Property="DisplaySource" Value="Content"/>
<Setter Property="ContentTemplate">
<Setter.Value>
<DataTemplate>
<TreeView ItemsSource="{Binding}">
<TreeView.ItemTemplate>
<HierarchicalDataTemplate ItemsSource="{Binding Path=ChildItems}" DataType="{x:Type common:MenuItemBase}">
<TextBlock Text="{Binding ItemText}" HorizontalAlignment="Stretch">
<TextBlock.ContextMenu>
<ContextMenu DataContext="{Binding RelativeSource={RelativeSource Mode=Self}}">
<MenuItem Header="{Binding MenuText}" Click="MenuItem_OnClick" />
</ContextMenu>
</TextBlock.ContextMenu>
</TextBlock>
</HierarchicalDataTemplate>
</TreeView.ItemTemplate>
</TreeView>
</DataTemplate>
</Setter.Value>
</Setter>
</Style>
</dxn:NavBarControl.Resources>
<dxn:NavBarControl.View>
<dxn:NavigationPaneView GroupDisplayMode="Text" ItemDisplayMode="Text" MaxVisibleGroupCount="12"/>
</dxn:NavBarControl.View>
</dxn:NavBarControl>
The binding is working, as my one treeview of menu items appears correctly, yet when I click (MouseDown
event) nothing happend, or when I double click, for the following handler, the handler does not execute:
private void Control_OnMouseDoubleClick(object sender, MouseButtonEventArgs e)
{
var x = sender;
}
My breakpoint on var x = sender;
never gets hit.
NOTE: I know I should not be using events but rather commands, or some other much less coupled code, but I urgently need to demo what happens when the user clicks a menu item, and before the event, my code for a command didn't fire either. What could be wrong here?