Hi,
I have a context menu on my XamGrid. I need to get the underlying rows datacontext when I click on a context menu item. For that I guess I would first need to set the row as selected on right clicking on a row. How do I achieve this? Please note that I'm asking for a solution for XamGrid and not XamDataGrid.
Thanks.
Ganesh
To Select the Row the following was implemented.
private static void MainXamGridPreviewMouseRightButtonDown(object sender, System.Windows.Input.MouseButtonEventArgs e) { var cell = Utilities.GetAncestorFromType(e.OriginalSource as DependencyObject, typeof(CellControl), true) as CellControl; var xamGrid = sender as XamGrid; if (cell == null || xamGrid == null) { return; }
xamGrid.Rows[cell.Cell.Row.Index].IsSelected = true; }