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

How to make context menu show on column/row headers

Thread ID:

Created:

Updated:

Platform:

Replies:

57602 Mar 7,2007 07:27 AM UTC Mar 7,2007 07:10 PM UTC WinForms 1
loading
Tags: GridControl
Ubaid
Asked On March 7, 2007 07:27 AM UTC


Hi Haneef

How can i make a context menu to drop only if i clicked on row headers or column headers.

Regards,
Ubaid Tariq

Administrator [Syncfusion]
Replied On March 7, 2007 07:10 PM UTC

Hi Ubaid,

One way you can do this by handling the MouseDown event of the grid and show the context menu when the header is clicked. Please refer to the attached sample for implementation and let me know if this helps.

[C#]
private void gridControl1_MouseDown(object sender, MouseEventArgs e) // Enters on Mouse Click Down
{
if (e.Button == MouseButtons.Right)
{
GridControl grid = sender as GridControl;
int row, col;
grid.PointToRowCol(e.Location, out row, out col);
if (row != -1 && col != -1)
{
if( grid.Model[row,col].CellType == "Header")
this.contextMenu1.Show(this.gridControl1, e.Location);
}
}
}

Sample : http://websamples.syncfusion.com/samples/Grid.Windows/F57308/main.htm


Best Regards,
Haneef

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

;