I'm quite new to WPF, and very new to the DevExpress WPF suite, so I just copied the original code above from an example somewhere. Then I thought to myself, why a ContextMenu
? Then, I right clicked the menu item, and a blank context menu item appeared, and that fired the event. I removed the bloody context menu, and now my menu item is firing the event, like I wanted when I asked this question. The new structure of the TreeView
is as follows:
<TreeView.ItemTemplate>
<HierarchicalDataTemplate ItemsSource="{Binding Path=ChildItems}" DataType="{x:Type menus:MenuItemBase}">
<MenuItem DataContext="{Binding}" Header="{Binding ItemText}" Click="MenuItem_OnClick" />
</HierarchicalDataTemplate>
</TreeView.ItemTemplate>
I'm still trying to get proper command binding working, but this answers my question about the events.