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

Align the column headers

Hello,

it's no problem to align to content of a cell. But how is it possible to align each column header text (left or right, not centering)?
I am using the latest api and vb.net.

Greetings

Wolfgang

3 Replies

PM Piruthiviraj Malaimelraj Syncfusion Team February 27, 2017 10:30 AM UTC

Hi Wolfgang, 

Thanks for your interest in Syncfusion products. 

Query 
Response 
 
 
 
 
 
 
 
 
How is it possible to align each column header text (left or right, not centering)? 
Suggestion 1: 
In order to align the header text at right/left/center side of the cell, HorizontalAlignment property of GridGroupingControl.Appearance.ColumnHeaderCell can be used.  
 
Code example: 
Me.gridGroupingControl1.Appearance.ColumnHeaderCell.HorizontalAlignment = Syncfusion.Windows.Forms.Grid.GridHorizontalAlignment.Right 

Suggestion 2: 
The header text can be aligned by using HorizontalAlignment property in QueryCellStyleInfo event also. 
 
Code example: 
AddHandler Me.gridGroupingControl1.QueryCellStyleInfo, AddressOf gridGroupingControl1_QueryCellStyleInfo 
 
Private Sub gridGroupingControl1_QueryCellStyleInfo(ByVal sender As Object, ByVal e As Syncfusion.Windows.Forms.Grid.Grouping.GridTableCellStyleInfoEventArgs) 
                If e.TableCellIdentity.DisplayElement.Kind = Syncfusion.Grouping.DisplayElementKind.ColumnHeader Then 
                                e.Style.HorizontalAlignment = Syncfusion.Windows.Forms.Grid.GridHorizontalAlignment.Right 
                End If 
End Sub 

 

Sample link: 
 
Regards, 
Piruthiviraj 



WA Wolfgang Anthony Eiden February 28, 2017 01:04 PM UTC

Thank you. Works fine.


PM Piruthiviraj Malaimelraj Syncfusion Team March 1, 2017 06:01 AM UTC

Hi Wolfgang, 

Thanks for the update. 

We are glad to hear that the provided solution is resolved your scenario. Please let us know if you have any other queries. 

Regards, 
Piruthiviraj 


Loader.
Up arrow icon