This question is locked. New answers and comments are not allowed.
Hello,
I am trying to use a RadContextMenu with a RadGridView. When I right click on a row I want a context menu to appear with a menu item whose Command is databound to an ICommand on my viewmodel and that passes in the row's DataContext as the CommandParameter. In Telerik's documentation I see Telerik set the RadGridView.SelectedItem to the row's DataContext in a RadContextMenu.Opened event handler. But I do not want to set the RadGridView.SelectedItem (if I did, then I would prefer to set the ICollectionView.CurrentItem in the viewmodel using the CommandParameter value). I suppose I could set the CommandParameter on the menu item in a RadContextMenu.Opened event handler, but I would prefer to set the CommandParameter using databinding. However, I can only get to the row by calling GridContextMenu.GetClickedElement<GridViewRow>(), so I cannot use the standard Binding markup extension. I wonder if a custom markup extension could do the trick. Has anybody done something like that or is there a better / easier way?
cheers
Remco
I am trying to use a RadContextMenu with a RadGridView. When I right click on a row I want a context menu to appear with a menu item whose Command is databound to an ICommand on my viewmodel and that passes in the row's DataContext as the CommandParameter. In Telerik's documentation I see Telerik set the RadGridView.SelectedItem to the row's DataContext in a RadContextMenu.Opened event handler. But I do not want to set the RadGridView.SelectedItem (if I did, then I would prefer to set the ICollectionView.CurrentItem in the viewmodel using the CommandParameter value). I suppose I could set the CommandParameter on the menu item in a RadContextMenu.Opened event handler, but I would prefer to set the CommandParameter using databinding. However, I can only get to the row by calling GridContextMenu.GetClickedElement<GridViewRow>(), so I cannot use the standard Binding markup extension. I wonder if a custom markup extension could do the trick. Has anybody done something like that or is there a better / easier way?
cheers
Remco