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
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

How to have two or more columns with column headers in a DropDown cell in WinForms GridGroupingControl?

Platform: WinForms |
Control: GridGroupingControl

Drop down cell

To have two or more columns with column headers in a dropdown cell, the GridListControl cell type can be used. ShowColumnHeader property will be used for displaying the column headers along with the following code.


//To add columns           
GridTableCellStyleInfo styleInfo = this.gridGroupingControl1.TableDescriptor.Columns["CategoryName"].Appearance.AnyRecordFieldCell;
styleInfo.DataSource = GetTable();
styleInfo.ValueMember = "ID";
styleInfo.DisplayMember = "Value";
styleInfo.CellType = "GridListControl";
GridDropDownGridListControlCellRenderer gcr1 = (GridDropDownGridListControlCellRenderer)gridGroupingControl1.TableControl.CellRenderers["GridListControl"];
gcr1.ListControlPart.ShowColumnHeader = true;
styleInfo.DropDownStyle = GridDropDownStyle.AutoComplete;



'To add columns           
Dim styleInfo As GridTableCellStyleInfo = Me.gridGroupingControl1.TableDescriptor.Columns("CategoryName").Appearance.AnyRecordFieldCell
styleInfo.DataSource = GetTable()
styleInfo.ValueMember = "ID"
styleInfo.DisplayMember = "Value"
styleInfo.CellType = "GridListControl"
Dim gcr1 As GridDropDownGridListControlCellRenderer = CType(gridGroupingControl1.TableControl.CellRenderers("GridListControl"), GridDropDownGridListControlCellRenderer)
gcr1.ListControlPart.ShowColumnHeader = True
styleInfo.DropDownStyle = GridDropDownStyle.AutoComplete


TableControlCurrentCellShowingDropDown event triggers when the dropdown list opened.


this.gridGroupingControl1.TableControlCurrentCellShowingDropDown += new GridTableControlCurrentCellShowingDropDownEventHandler(gridGroupingControl1_TableControlCurrentCellShowingDropDown);
void gridGroupingControl1_TableControlCurrentCellShowingDropDown(object sender, GridTableControlCurrentCellShowingDropDownEventArgs e)
    GridDropDownGridListControlCellRenderer cr = this.gridGroupingControl1.TableControl.CurrentCell.Renderer as GridDropDownGridListControlCellRenderer;
    if (cr != null)
        ((GridDropDownGridListControlPart)cr.ListControlPart).DropDownRows = 5;



Private Me.gridGroupingControl1.TableControlCurrentCellShowingDropDown += New GridTableControlCurrentCellShowingDropDownEventHandler(AddressOf gridGroupingControl1_TableControlCurrentCellShowingDropDown)
Private Sub gridGroupingControl1_TableControlCurrentCellShowingDropDown(ByVal sender As Object, ByVal e As GridTableControlCurrentCellShowingDropDownEventArgs)
     Dim cr As GridDropDownGridListControlCellRenderer = TryCast(Me.gridGroupingControl1.TableControl.CurrentCell.Renderer, GridDropDownGridListControlCellRenderer)
     If cr IsNot Nothing Then
         CType(cr.ListControlPart, GridDropDownGridListControlPart).DropDownRows = 5
     End If
End Sub



Two columns in a single column header



C#: Two or more columns with column header

VB: Two or more columns with column header


2X faster development

The ultimate WinForms UI toolkit to boost your development speed.
You must log in to leave a comment

Please sign in to access our KB

This page will automatically be redirected to the sign-in page in 10 seconds.

Up arrow icon

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

Live Chat Icon For mobile