Link to home
Start Free TrialLog in
Avatar of camasuvi
camasuvi

asked on

Datagrid right click -- open menu


It is easy to assign a contextmenu to a datagrid. But i wonder when a cell is active and the user clicks thr right click how can i open a specialized menu ?
Avatar of Éric Moreau
Éric Moreau
Flag of Canada image

Avatar of camasuvi
camasuvi

ASKER

Thanks but i saw the page.

This is something else....

do you have some code examples ? did you try ?

Thanks
Would adding an event handler for the CurrentCellChanged event allow you to enable this?

The CurrentCellChanged event will fire when the user activates a cell, so you could set one of a number of pre-determined context menus for the datagrid in the event handler depending on which column or row has been selected.

Another option would be to generate HitTest info in an event handler for the Mouse_Down event, and set the context menu for whichever part of the datagrid was selected. This way a different context menu could be set when a user right-clicks on the background or column header as opposed to when clicking on a column.

Tom.

 
 
The problem,

When i activated the text in a datagrid cell the mouse_down event for the datagrid does not work....

Thanks,
When i attach a right click menu(Context menu) to my grid
control.. then when I select some text in the textbox
control in the grid and do RMC, i get the cut/copy/paste
RMC instead of thje menu i have associated the grid to..
ASKER CERTIFIED SOLUTION
Avatar of TheAvenger
TheAvenger
Flag of Switzerland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial