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.

ColumnHeader Double Click

Thread ID:

Created:

Updated:

Platform:

Replies:

22249 Dec 7,2004 04:40 PM Dec 8,2004 02:20 AM Windows Forms 1
loading
Tags: Grouping
Bernard Herrok
Asked On December 7, 2004 04:40 PM

Hi, I want to capture what column header was double clicked. I''m using the TableControlCellDoubleClick event, which has the GridTableControlCellClickEventArgs. The options i get are Inner and TableControl. The thing is when i chose inner, it gives me the wrong column index and if i chose tablecontrol.currentcell i get -1 for rowindex and colindex, because nothing''s selected obviously. How do i get the column index of the column header the users'' clicked on? i also need to check if it''s the column header that''s been clicked (rowindex = 0). thanks in advanced!

Administrator [Syncfusion]
Replied On December 8, 2004 02:20 AM

For me, I could not get TableControlCellDoubleClick to be raised on header cells. I might have differernt properties set than you do. But I was able to use TableControlMouseDown and look for 2 leftclicks. In that event, you can test for a header row and get teh column clicked using code like:
private void gridGroupingControl1_TableControlMouseDown(object sender, GridTableControlMouseEventArgs e)
{
	if(e.Inner.Clicks == 2 && e.Inner.Button == MouseButtons.Left)
	{
		int row, col;
		Point pt = new Point(e.Inner.X, e.Inner.Y);
		if(e.TableControl.PointToRowCol(pt, out row, out col))
		{
			GridColumnHeaderRow headerRow = e.TableControl.Table.DisplayElements[row] as GridColumnHeaderRow;
			if(headerRow != null)
			{
				int pos = e.TableControl.TableDescriptor.ColIndexToField(col);
				string colName = e.TableControl.TableDescriptor.VisibleColumns[pos].Name;
				Console.WriteLine(colName);
			}
		}
	}
}

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.

;