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. Image for the cookie policy date

GGC header doubleclick / resize

I've a GGC and want to sort the column by single clicking on the header and resize the column to fit to the content when doubleclicking on the header.

At the moment I'm using the following code:

private void gridGroupingControl_TableControlCellDoubleClick(object sender, Syncfusion.Windows.Forms.Grid.Grouping.GridTableControlCellClickEventArgs e)
{
this.gridGroupingControl.Enabled = false;
//MY CODE TO OPEN THE CURRENT ITEM
this.gridGroupingControl.Enabled = true;
}

What happens is, that when I'm single clicking on the header the grid is sorting correctly but when I'm doubleclicking, an item is opening.

Can you help me in:
*) How to avoid opening an item when doubleclicking on the header.
*) How to fit the column width when doubleclicking on the header.

BR
Christoph


1 Reply

AD Administrator Syncfusion Team March 27, 2008 07:10 PM UTC

Hi Christoph,

Please refer the code below to fit the column width when doubleclicking on the header and to avoid opening an item when doubleclicking on the header.



void gridGroupingControl1_TableControlCellDoubleClick(object sender, GridTableControlCellClickEventArgs e)

{
GridTableCellStyleInfo style = e.TableControl.GetTableViewStyleInfo(e.Inner.RowIndex, e.Inner.ColIndex);
if (style.TableCellIdentity.TableCellType == GridTableCellType.ColumnHeaderCell)
{
this.gridGroupingControl1.TableControl.Model.ColWidths.ResizeToFit(GridRangeInfo.Col(e.Inner.ColIndex) , GridResizeToFitOptions.IncludeHeaders);
this.gridGroupingControl1.Refresh();
}
else

{

//Your Code to open the current item.
}
}



Please let me know if this helps.

Regards,
Srirajan




Loader.
Live Chat Icon For mobile
Up arrow icon