When I right click on a row, I want the row to become selected. I also want a context menu in which each menu item uses an ICommand.
To get the right click selection, I'm handling the context menu's Opened event, using RadContentMenu's GetClickedElement<GridViewRow>() method, and changing the gridview's SelectedItems appropriately.
The trouble is, the Command's CanExecute method is getting called before the context method's Opened is called. So my CanExecute is analyzing the previously selected item(s). At one point I fiddled with things enough to get the CanExecute to also be called after I changed the selection, but the user can see the menu items become enabled/disabled and that's no good.
If CanExecute is being called before the context menu opens, I need to change the selections before CanExecute and Opened are called.
How can I get the behavior I want?
Maybe if there was a PreviewOpen event on the context menu. Or maybe I can handle a row clicked event, look for right-clicked, and change the selection there? If so, I don't know how to do that at the moment.
Thanks for any help!
Buzz
To get the right click selection, I'm handling the context menu's Opened event, using RadContentMenu's GetClickedElement<GridViewRow>() method, and changing the gridview's SelectedItems appropriately.
The trouble is, the Command's CanExecute method is getting called before the context method's Opened is called. So my CanExecute is analyzing the previously selected item(s). At one point I fiddled with things enough to get the CanExecute to also be called after I changed the selection, but the user can see the menu items become enabled/disabled and that's no good.
If CanExecute is being called before the context menu opens, I need to change the selections before CanExecute and Opened are called.
How can I get the behavior I want?
Maybe if there was a PreviewOpen event on the context menu. Or maybe I can handle a row clicked event, look for right-clicked, and change the selection there? If so, I don't know how to do that at the moment.
Thanks for any help!
Buzz