How to customize the column header text in WinForms MultiColumnComboBox?
Customize the column header
In WinForms MultiColumnComboBox, the column header can be customized by handling the QueryCellInfo event of the GridListBox in MultiColumnComboBox.
The default name of the column header is assigned from the ColumnName of the DataTable.
The following code example demonstrates the same.
C#
//To specify the style. (this.multiColumnComboBox1.ListControl as GridListBox).Grid.Model.QueryCellInfo += new Syncfusion.Windows.Forms.Grid.GridQueryCellInfoEventHandler(Model_QueryCellInfo); void Model_QueryCellInfo(object sender, Syncfusion.Windows.Forms.Grid.GridQueryCellInfoEventArgs e) { //To specify the row and colum index. if (e.RowIndex == 0 && e.ColIndex == 1) { //To specify the font e.Style.Font = new Syncfusion.Windows.Forms.Grid.GridFontInfo(new Font("Segoe UI", 15, FontStyle.Bold, GraphicsUnit.Pixel)); //To specify the text e.Style.Text = "Name"; //To specify the text color. e.Style.TextColor = Color.Red; } }
VB
'To specify the style. AddHandler TryCast(multiColumnComboBox1.ListControl, GridListBox).Grid.Model.QueryCellInfo, AddressOf Model_QueryCellInfo Private Sub Model_QueryCellInfo(ByVal sender As Object, ByVal e As Syncfusion.Windows.Forms.Grid.GridQueryCellInfoEventArgs) 'To specify the row and colum index. If e.RowIndex = 0 AndAlso e.ColIndex = 1 Then 'To specify the font e.Style.Font = New Syncfusion.Windows.Forms.Grid.GridFontInfo(New Font("Segoe UI", 15, FontStyle.Bold, GraphicsUnit.Pixel)) 'To specify the text e.Style.Text = "Name" 'To specify the text color. e.Style.TextColor = Color.Red End If End Sub
Figure 1. The specific cell of the column header is customized.
Samples:
C#: MultiColumnComboBox_HeaderCaption_Customization_C#
VB: MultiColumnComboBox_HeaderCaption_Customization_VB
Conclusion
I hope you enjoyed learning about how to customize the column header text in WinForms MultiColumnComboBox.
You can refer to our WinForms MultiColumnComboBox feature tour page to know about its other groundbreaking feature representations and documentation, and how to quickly get started for configuration specifications.
For current customers, you can check out our 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 other controls.
If you have any queries or require clarifications, please let us know in the comments section below. You can also contact us through our support forums, Direct-Trac, or feedback portal. We are always happy to assist you!