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

context menu

Hi,
I am trying to add a context sensitive menu for a windows forms with a grid control.
So I've used a context menu and added it.
But the context menu doesn't disappear even after selecting my option.
How can i set it that the context menu disappears after right click?

Thanks
Smitha


2 Replies

MC Mercy C Syncfusion Team April 10, 2012 05:09 AM UTC

Hi Smitha,

Thanks for your interest in Syncfusion products.

You can handle "CellClick" event to display the context menu when right mouse button is clicked.

void gridControl1_CellClick(object sender, Syncfusion.Windows.Forms.Grid.GridCellClickEventArgs e)
{
if (e.RowIndex >= 2 && e.MouseEventArgs.Button == MouseButtons.Right)
{
this.contextMenuStrip1.Show(this.gridControl1, e.MouseEventArgs.Location);
}
}

Please refer to the sample in the following link
http://www.syncfusion.com/downloads/Support/DirectTrac/93095/WindowsFormsApplication81868417365.zip

Please let me know if you have any concerns.

Regards,
Mercy.C



RB Ragamathulla B Syncfusion Team April 10, 2012 05:11 AM UTC

Hi Smitha,

Thank you for your interest in syncfusion products,

You can have context menu on right click on column headers by using ‘TableControlCellClick’ event along with the following code. Please refer the following code to achieve the behavior.

Sample link:

http://www.syncfusion.com/uploads/redirect.aspx?&team=support&file=847071641385806.zip

Let me know if you have any further concerns.

Regards,
Ragamathullah B.


Loader.
Live Chat Icon For mobile
Up arrow icon