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.

Column header height in GGC

Thread ID:

Created:

Updated:

Platform:

Replies:

125411 Aug 15,2016 06:05 PM Aug 23,2016 07:35 AM Windows Forms 7
loading
Tags: GridGroupingControl
Nicolas
Asked On August 15, 2016 06:05 PM

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 12:37 AM

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); 

Regards, 
Neelakandan 
 


Nicolas
Replied On August 16, 2016 10:36 AM

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 06:29 AM

Hi Paul, 

Sorry for the inconvenience caused. 

Query  
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. 


Query 
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  
GridTableCellStyleInfoEventHandler(gridGroupingControl1_QueryCellStyleInfo); 
 
void gridGroupingControl1_QueryCellStyleInfo(object sender, GridTableCellStyleInfoEventArgs e) 
{ 
if (e.TableCellIdentity != null && (e.TableCellIdentity.TableCellType == GridTableCellType.RecordFieldCell  
    || e.TableCellIdentity.TableCellType == GridTableCellType.AlternateRecordFieldCell) && 
    e.TableCellIdentity.DisplayElement.GetRecord().IsSelected()) 
    e.Style.BackColor = Color.Red; 

 
Regards, 
Neelakandan 
 


Nicolas
Replied On August 17, 2016 01:07 PM

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

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

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) 
    { 
        rowIndex=el.GetRowIndex(); 
        break; 
    } 
} 
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); 
} 
 
Regards, 
Mohanraj G.  


Nicolas
Replied On August 22, 2016 09:10 PM

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 07:35 AM

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? 

Regards, 
Amal Raj U. 


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.

;