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.
Syncfusion Feedback

ContextMenu in GGC

Thread ID:

Created:

Updated:

Platform:

Replies:

48625 Aug 31,2006 01:11 PM UTC Sep 4,2006 07:46 AM UTC Windows Forms 3
loading
Tags: GridControl
Administrator [Syncfusion]
Asked On August 31, 2006 01:11 PM UTC

Hi,

I have GGC and I want to show up a Contextmenu when a user clicks in the area of the GGC. The context menu should show up even if the user clicks in an area where no cells are.

So I think I can''t use the TableControlCellClick event here. Any ideas?

Thank you
Tom

Administrator [Syncfusion]
Replied On August 31, 2006 02:06 PM UTC

Hi Tom,

Try handling the TableControlMouseDown event of the GridGroupingControl and show your contextmenu there.

private void gridGroupingControl1_TableControlMouseDown(object sender, GridTableControlMouseEventArgs e)
{
if(e.Inner.Button == MouseButtons.Right)
{
this.contextMenu1.Show(this.gridGroupingControl1, this.gridGroupingControl1.PointToClient(Control.MousePosition));
}
}

Regards,
Rajagopal

Administrator [Syncfusion]
Replied On September 1, 2006 07:36 AM UTC

Hi,

thanks your solution works fine - but I have a got a further problem. I have also defined another context menu for a cell click (with a TableControlCellClick event). Now I want to disable the context menu for the TableControlMouseDown event if the user clicks on a cell - is this possible?

Currently there are two context menus shown if a user clicks on a cell (one for the TableControlMouseDown event and another for the TableControlCellClick)

Administrator [Syncfusion]
Replied On September 4, 2006 07:46 AM UTC

Hi Tom,

Try the code below in the TableControlMouseDown event to conditionally display a context menu for the grid and not for cells.

private void gridGroupingControl1_TableControlMouseDown(object sender, GridTableControlMouseEventArgs e)
{
GridTableCellStyleInfo styleinfo = e.TableControl.PointToTableCellStyle(new Point(e.Inner.X, e.Inner.Y));
if(e.Inner.Button == MouseButtons.Right && styleinfo.TableCellIdentity.TableCellType == GridTableCellType.EmptyCell)
{
// show contextmenu1
this.contextMenu1.Show(this.gridGroupingControl1, this.gridGroupingControl1.PointToClient(Control.MousePosition));
}
}

private void gridGroupingControl1_TableControlCellClick(object sender, GridTableControlCellClickEventArgs e)
{
if(e.Inner.MouseEventArgs.Button == MouseButtons.Right)
{
// show contextmenu2
this.contextMenu2.Show(this.gridGroupingControl1, this.gridGroupingControl1.PointToClient(Control.MousePosition));
}
}

Let me kmow if this helps.
Regards,
Rajagopal

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.

Warning Icon 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.Close Icon

;