Home Forums WinForms controls Xceed Grid for WinForms Context menu in master/detail Reply To: Context menu in master/detail

User (Old forums)
Member
Post count: 23064

Try this (untested code):<code>grid.MouseDown += new MouseEventHandler(grid_MouseDown);
private void grid_MouseDown(object sender, MouseEventArgs e) {
if (e.Button == MouseButtons.Right) {
VisualGridElement element = grid.GetVisualGridElementAtPoint(e.X, e.Y);
Row row;
if (element is Row) row = element as Row;
else if (element is Cell) row = (element as Cell).ParentRow;
else row = null;
if (row != null) {
grid.CurrentRow = row;
row.BringIntoView();
grid.ContextMenu.Show(grid, new Point(e.X, e.Y));
}
}
}</code>

Imported from legacy forums. Posted by Tommy (had 262 views)