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. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

TableControlCellMouseUp and ContextMenu with GridGroupingcontrol

Thread ID:

Created:

Updated:

Platform:

Replies:

19524 Sep 28,2004 01:12 PM UTC Sep 28,2004 01:58 PM UTC WinForms 1
loading
Tags: GridControl
Albert Gao
Asked On September 28, 2004 01:12 PM UTC

Initially I assigned a contextmenu to the GridGroupingControl. It worked fine. Since I need to differentiate if the context menu is on column header/regular cell/blank area, I added TableControlCellMouseUp handler. I found the context menu is not working after the handler is added. I can popup the context menu in header/cell, but I have no way to popup it in blank area. what''s the proper way to popup context menu in any situation? Thanks, albert

Administrator [Syncfusion]
Replied On September 28, 2004 01:58 PM UTC

Currently, I think you will have to handle 2 events to catch both these situations. The grid.TableControl.MouseUp will catch the click where there are no cells.
this.gridGroupingControl1.TableControlCellMouseUp += new Syncfusion.Windows.Forms.Grid.Grouping.GridTableControlCellMouseEventHandler(gridGroupingControl1_TableControlCellMouseUp);
this.gridGroupingControl1.TableControl.MouseUp += new MouseEventHandler(TableControl_MouseUp);

private bool TableControlCellMouseUpHit = false;

private void gridGroupingControl1_TableControlCellMouseUp(object sender, Syncfusion.Windows.Forms.Grid.Grouping.GridTableControlCellMouseEventArgs e)
{
	if(e.Inner.MouseEventArgs.Button == MouseButtons.Right)
	{
		TableControlCellMouseUpHit = true;
		this.contextMenu1.Show(this.gridGroupingControl1, 
			this.gridGroupingControl1.PointToClient(Control.MousePosition));
	}
}

private void TableControl_MouseUp(object sender, MouseEventArgs e)
{
	if(!TableControlCellMouseUpHit && e.Button == MouseButtons.Right)
		this.contextMenu1.Show(this.gridGroupingControl1, 
			this.gridGroupingControl1.PointToClient(Control.MousePosition));
	TableControlCellMouseUpHit = false;
}

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.

Please sign in to access our forum

or the page will be automatically redirected to sign-in page in 10 seconds.

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

;