We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
close icon

Select Cell on Right Mouse CLick

I am making a right click context menu available in my grid. The menu may be different depending on which cell was "right clicked" on. I can detect the Current Cell, but the Right CLick action does not make a cell the current cell.

I know how to use the MouseRightButtonDown and MouseRightButtonUp events, but I don't know how to detect which cell the user was over when they performed the right click action.

Is it possible to activte the cell using the right click event?

Thanks for your help.


3 Replies

MN Muthulakshmi N Syncfusion Team July 15, 2010 01:04 PM UTC

Hi William,

Handling MouseRightButtonDown event you can activate the current cell during right click action of the mouse. The c# code is given below.

Code behind:

void gridControl1_MouseRightButtonDown(object sender, MouseButtonEventArgs e)
{
var cell = this.gridControl1.PointToCellRowColumnIndex(e);
this.gridControl1.CurrentCell.Activate(cell.RowIndex,cell.ColumnIndex);
this.gridControl1.CurrentCell.MoveTo(cell);
e.Handled = true;
}

Let us know if you need any details.

Regards,
Muthulakshmi


AD Administrator Syncfusion Team July 16, 2010 01:40 PM UTC

Thank you, this worked perfectly.


MN Muthulakshmi N Syncfusion Team July 23, 2010 06:51 AM UTC

Hi William,

Thanks for the details. Let us know if you face any other issues.

Regards,
Muthulakhmi

Loader.
Live Chat Icon For mobile
Up arrow icon