How to change the header text in a WinForms GridListControl?
Change the header text
The column
header text of the WinForms GridListControl can be changed by setting
the text property of header cell in PrepareViewStyleInfo event
of GridListControl.
C#
//Triggering the event.
this.gridListControl1.Grid.PrepareViewStyleInfo += Grid_PrepareViewStyleInfo;
//Event customization.
void Grid_PrepareViewStyleInfo(object sender, GridPrepareViewStyleInfoEventArgs e)
{
//Check whether cell is header cell or not.
if(e.ColIndex == 1 && e.RowIndex == 0)
{
e.Style.Text = "Header";
}
} VB
'Triggering the event.
AddHandler Me.gridListControl1.Grid.PrepareViewStyleInfo, AddressOf Grid_PrepareViewStyleInfo
'Event customization.
Private Sub Grid_PrepareViewStyleInfo(ByVal sender As Object, ByVal e As GridPrepareViewStyleInfoEventArgs)
'Check whether cell is header cell or not.
If e.ColIndex = 1 AndAlso e.RowIndex = 0 Then
e.Style.Text = "Header"
End If
End Sub
Samples:
Conclusion
I hope you enjoyed learning about how to change the header text in GridListControl.
You can refer to our WinForms GridListControl feature tour page to know about its other groundbreaking feature representations. You can also explore our WinForms GridListControl documentation to understand how to present and manipulate data.
For current customers, you can check out our WinForms components from the License and Downloads page. If you are new to Syncfusion, you can try our 30-day free trial to check out our WinForms GridList and other WinForms components.
If you have any queries or require clarifications, please let us know in the comment section below. You can also contact us through our support forums, Direct-Trac, or feedback portal. We are always happy to assist you!