I add a menu item in context menu for a xamDataGrid with following code.
MenuItem item = new MenuItem();
item.IsEnabled = isEnable;
item.Header = "C_ut";
item.Command = ApplicationCommands.Cut;
Sometimes the menu item is enable only when I click a cell with left mouse button.
If I right click a cell to popup the menu directly, it is disabled. Who know how to solve it?
I solve it by making grid on focus.
Hello,
Yes, this is because the command looks for the focused element. If you right click on the cell, you do not have one. What you can do is select the cell in the preview mouse right button down event of the CVP or the XamDataGrid.