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.
Unfortunately, activation email could not send to your email. Please try again.

context menu in GGC

Thread ID:

Created:

Updated:

Platform:

Replies:

73262 Apr 28,2008 08:58 AM May 2,2008 02:14 AM Windows Forms 1
loading
Tags: GridControl
Prabhjeet
Asked On April 28, 2008 08:58 AM

I am using syncfusion GGC 6.1. I have to display context menu on right click of my mouse. Now my problem is that for header i have to show a different context menu and for cell click i have to show a different context menu. Now when i right click on header then both my context menu gets opened. Is there any way by which header displays only one menu and cells displays the other menu.

I will be very thankful if anyone could help me in this.


Jisha Joy [Syncfusion]
Replied On May 2, 2008 02:14 AM

Hi Prabhjeet,

Thank you for posting query to us.

This can be achieved by handling the TableControl.MouseUp event of GridGroupingControl. Please refer the code:



this.gridGroupingControl1.TableControl.MouseUp += new MouseEventHandler(TableControl_MouseUp);
void TableControl_MouseUp(object sender, MouseEventArgs e)
{

if (e.Button == MouseButtons.Right)
{
GridTableControl tableControl = sender as GridTableControl;
GridTableCellStyleInfo style = (GridTableCellStyleInfo)tableControl.PointToTableCellStyle(new Point(e.X, e.Y));
Point pt = tableControl.PointToClient(Control.MousePosition);

if (style.TableCellIdentity.DisplayElement.Kind == DisplayElementKind.ColumnHeader)
{
this.contextMenuStrip1.Show(tableControl, pt);


}
else if (style.TableCellIdentity.DisplayElement.Kind == DisplayElementKind.Caption)
{
this.contextMenuStrip2.Show(tableControl, pt);


}
else if (style.TableCellIdentity.ColIndex == 0)
{
this.contextMenuStrip3.Show(tableControl, pt);

}
else if (style.TableCellIdentity.DisplayElement.Kind == DisplayElementKind.Record)
{
this.contextMenuStrip4.Show(tableControl, pt);
}


}

}

Please refer the sample in the link to illustrate this:
http://websamples.syncfusion.com/samples/Grid.Windows/37401/main.htm

Kindly try this and let me know if you need further assistance.

Regards,
Jisha






CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.

;