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

Column header height in GGC

Thread ID:





125411 Aug 15,2016 10:05 PM UTC Aug 23,2016 11:35 AM UTC WinForms 7
Tags: GridGroupingControl
Asked On August 15, 2016 10:05 PM UTC

Hi, when I change font size in my grid, I have problems with column height that does not auto-adjust when I do : GGC.Appearance.ColumnHeaderCell.AutoSize = True. I tried to find alternatively to adjust the Column Header height manually, but it seems this property is not available. Am I doing something wrong? Thank you in advance! - Nicolas

Neelakandan Kannan [Syncfusion]
Replied On August 16, 2016 04:37 AM UTC

Hi Nicolas, 

Thanks for your interest in Syncfusion products. 

The column header row height or column width can be resized based on its font style and size by using the ResizeToFit method. Please make use of below code, 

Code snippet 
//To resize the column header's width 
this.gridGroupingControl1.TableModel.ColWidths.ResizeToFit(GridRangeInfo.Row(this.gridGroupingControl1.TableControl.TopRowIndex - 1), GridResizeToFitOptions.IncludeHeaders); 
//To resize the column header's row height.  
this.gridGroupingControl1.TableModel.RowHeights.ResizeToFit(GridRangeInfo.Row(this.gridGroupingControl1.TableControl.TopRowIndex - 1), GridResizeToFitOptions.IncludeHeaders); 


Replied On August 16, 2016 02:36 PM UTC

Hi! Thank you for the prompt answer on this! I tried the codes, and it worked well using GridRangeInfo.Table(), but failed to achieve to resize either Column header height or width using GridRangeInfo.Row(this.gridGroupingControl1.TableControl.TopRowIndex - 1). As I do not want necessarily to resize the complete table, could you propose an alternative to the proposed GridRangeInfo? Thank you in advance! - Nicolas

Neelakandan Kannan [Syncfusion]
Replied On August 17, 2016 10:29 AM UTC

Hi Paul, 

Sorry for the inconvenience caused. 

Solution Feedback 

As per screenshots, we understood that the you don’t want to set the selection backcolor by hardcode and the selection backcolor should be taken from the backcolor of the row. As per this case, we had provided the solution as ListBoxSelectionColorOptions  =  GridListBoxSelectionColorOptions.None.  
We have provided the information about all the options available in the Selections in the below UG link, 
We have provided information about customization and workarounds in the below Knowledge Base, 
We will ensure that this kind of miscommunication won’t happen anymore in the future. Thanks for your understanding. 

How can I detect the the cell style info event QueryCellStyleInfo(object sender, GridTableCellStyleInfoEventArgs e) being on a "selected row"?  

The row can be checked if it is selected or not by the using the GetRecord().IsSelected() method. Please make use of the below code, 

this.gridGroupingControl1.QueryCellStyleInfo += new  
void gridGroupingControl1_QueryCellStyleInfo(object sender, GridTableCellStyleInfoEventArgs e) 
if (e.TableCellIdentity != null && (e.TableCellIdentity.TableCellType == GridTableCellType.RecordFieldCell  
    || e.TableCellIdentity.TableCellType == GridTableCellType.AlternateRecordFieldCell) && 
    e.Style.BackColor = Color.Red; 


Replied On August 17, 2016 05:07 PM UTC

Hi Neelakandan, I believe you are in the wrong topic here - Nicolas

Mohanraj Gunasekaran [Syncfusion]
Replied On August 18, 2016 04:11 PM UTC

Hi Nicolas, 
Sorry for the inconvenience caused, 
We have analyzed your query at our end. You can achieve your requirement by using the Element.GetRowIndex method. Please refer the following code snippet. 
Code snippet: 
foreach (Element el in this.gridGroupingControl1.Table.NestedDisplayElements) 
    if (el.Kind == Syncfusion.Grouping.DisplayElementKind.ColumnHeader) 
if (rowIndex >= 0) 
    //To resize the column header's width  
    this.gridGroupingControl1.TableModel.ColWidths.ResizeToFit(GridRangeInfo.Row(rowIndex), GridResizeToFitOptions.IncludeHeaders); 
    //To resize the row height's width  
    this.gridGroupingControl1.TableModel.RowHeights.ResizeToFit(GridRangeInfo.Row(rowIndex), GridResizeToFitOptions.IncludeHeaders); 
Mohanraj G.  

Replied On August 23, 2016 01:10 AM UTC

Hi, I have tried both solutions using the event, this, in order to resize column header row height upon resize by the end-user :

Private Sub TableModel_QueryColWidth(sender As Object, e As GridRowColSizeEventArgs)

Apparently, both solutions get into an infinite loop on the form opening. It is not an important feature at the moment, just a "nice-to-have", maybe the team could think of integrating a dedicated property for this one in a future deployment. My side, I consider the case as closed, but let me know if there is any development, thanks to the team - Nicolas

Amal Raj Umapathy Selvam [Syncfusion]
Replied On August 23, 2016 11:35 AM UTC

Hi Nicolas, 

Thanks for the update. 

As per the current support provided in the GridGroupingControl, there is no support to get the row index of the column header section without using loop. As per our previous update, the loop will not be executed for infinite times as we break the loop once the column section is found. So the loop will execute maximum of 2 to 3 times only. Please let us know if we missed anything.  

If you are facing infinite loop for the given solution, could you please send us the sample with issue reproducing, so that we can find out the cause of issue and provide you the solution at the earliest? 

Amal Raj U. 


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

This page will automatically be redirected to the 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