In my ultragrid, right-clicking on any cell brings up a right-click menu of actions pertinent to that row. We show the menu in the MouseUp event after checking if MouseEventArgs.Button = MouseButton.Right. Unfortunately there's no easy way to get what the user clicked on in the grid.
But there's a ClickCell event that does tell me what an user clicked on. I don't have to do any work to figure out what the user clicked on. It just tells me (with .Cell property). I like this much better than the Mouse* group of events.
Unfortunately there's no way to know if they right-clicked. Is there some other event that I could use, or am I stuck using MouseUp? What's the easiest/clearest way to do this?
Yea, that's what I ended up doing. Thanks for the quick response :)
Hi Jeffrey,
The best thing to do is use the MouseDown event to store the last mouse button in a variable. Then you can reference that variable inside the Click or CellClick event to know which button was used.
This is true for the Click event of any Windows Forms Control. I'm not sure why Microsoft decided not to provide the mouse button inside the Click event, but I'm sure there's probably some reason.