Hello,
I try to handle right mouse button clicks on grid cells. This is what I do:
void xGrid_CellControlAttached(object sender, CellControlAttachedEventArgs e) { e.Cell.Control.MouseRightButtonDown += xGrid_CellMouseRightButtonDown; e.Cell.Control.MouseRightButtonUp += xGrid_CellMouseRightButtonUp; } private void xGrid_CellMouseRightButtonUp(object sender, MouseButtonEventArgs e) { // do something } void xGrid_CellMouseRightButtonDown(object sender, MouseButtonEventArgs e) { e.Handled = true; }
But I have s a problem. Some cells have IsEnabled property set to False and I cannot handle right clicks on such cells. But I have to. Is there a workaround for this?
Thank you.
Hi,
Why are you disabling the cells? Are you disabling entire column's or just specific cells in certain rows / columns?
Could you achieve what you're looking for with a "disabled" style instead?
As for how you're attaching the event, you need to be careful, b/c you're going to wind up hooking the same event handler to the same control multiple times, as cell controls become recycled, so be sure to call -= before attaching a new event handler.
-SteveZ