Home Forums WinForms controls Xceed Grid for WinForms Context Menu for Xceed Grid Reply To: Context Menu for Xceed Grid

User (Old forums)
Post count: 23064

I assume you’re using the ContextMenu property of the gridcontrol. The problem with this property is that no events are fired when the context menu should be displayed. If you want more control over this, you’ll have to implement your own handler.
myGridControl.MouseDown += new MouseEventHandler(myGridControl_MouseDown);

private void myGridControl_MouseDown(object sender, MouseEventArgs e)
if (e.Button == MouseButtons.Right)
Xceed.Grid.DataCell cell = myGridControl.GetVisualGridElementAtPoint(e.X, e.Y) as Xceed.Grid.DataCell;
if (cell != null)
Xceed.Grid.DataRow row = cell.ParentRow as Xceed.Grid.DataRow;
myContextMenu.Show(myGridControl, new System.Drawing.Point(e.X, e.Y));

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