I need to provide right-click popup context menu support for a cell in a datagrid.
As some of you might know with Silverlight 4 DataGrid if you right-click the item, then your selection isn’t updated with whatever you right-clicked on.
The related StackOverflow question ( Silverlight Datagrid select on right click ) address most of this issue in that it selects the correct row when using right click.
My question is how to I get the correct column selected?
Thanks,
Jaans
Update: I’ve discovered a static method on the DataGridColumn (and DataGridRow) classes that have helped my create a solution.
Not sure this is the best solution, but it seems to work so far.
Here’s a generic helper method:
I then use it in the Row_MouseRightButonDown event as per the other StackOverflow question referenced above: