contextMenu & Datagrid

  • Thread starter Thread starter MDB
  • Start date Start date
M

MDB

Hello All,

I have a datagrid with multiple rows and columns When a user taps a column
I update the quantity by one and then when they tap and hold, I display a
context menu with Subtract and Quantity displayed. Everything works fine
however, I can not figure out how to tell which of the datagrids
cells(row/column) is selected where the context menu is displayed. Can
anyone help? I have tried DataGrid.CurrentCell however, if the cell is not
highlighted/selected, it doesn't work.

Thanks In Advance
 
MDB,

What you want to do is get the coordinates for where the button press
took place. Since I assume you are handling the mouse down event, you
should have no problem finding out these coordinates. Once you do that, you
can pass them through to the HitTest method on the DataGrid, and it will let
you know where on the grid the coordinate applies to (including the row and
column number of the cell, if applicable).

Hope this helps.
 
Back
Top