Nov 25, 2013 at 7:24 PM
Edited Nov 25, 2013 at 7:28 PM
It seems (from other posts with similar problems) that I am trying to bind the target to an element which doesn't exist in the same visual tree and that one has to set the Tag of the parent of the ContextMenu to reference the ViewModel, but that is what
I am trying above and can't get to work.
If I handle it in the View, it works perfectly using the example code:
this.radTreeView.AddHandler( RadMenuItem.ClickEvent, new RoutedEventHandler( OnContextMenuClick ) );
private void RadContextMenu_Opened(object sender, RoutedEventArgs e)
private void OnContextMenuClick(object sender, RoutedEventArgs args)
But I would like to set it up directly in the XAML, so that the ViewModel method is called directly without having to go via the View.
If I handle it in the View, I have to set up a reference to the ViewModel and then call the ViewModel's method from the View which I would like to avoid by setting it up correctly in the XAML.