Home All Groups Group Topic Archive Search About

Datagrid - right click select and context menu

Author
13 Apr 2005 6:12 PM
skOOb33
I have a context menu for a datagrid that shows up fine.  I am wanting
to set it to where when a user right clicks anywhere on the grid, it
will select the row the mouse is over (if it's over one), and then
display the context menu.  Any help is appreciated.

thanks

Author
13 Apr 2005 6:50 PM
Chris
skOOb33 wrote:
> I have a context menu for a datagrid that shows up fine.  I am wanting
> to set it to where when a user right clicks anywhere on the grid, it
> will select the row the mouse is over (if it's over one), and then
> display the context menu.  Any help is appreciated.
>
> thanks
>

You will need to use the HitTestInfo class to determine if the DataGrid
is over a cell.  If it is then you will use the DataGrid.Select command
to select the row you want.  Just run those calls before you open your
context menu.

Chris