Articles in this section
Category / Section

How to remove the dropdown button in a cell in WinForms GridControl and GridGroupingControl?

1 min read

Remove the dropdown button

By default, the dropdown button will be displayed in the ComboBox, RichText, NumericUpDown and MonthCalender cells to show dropdown dialog. In order to hide the dropdown button of a grid cell, the ShowButtons property of GridStyleInfo can be set to GridShowButtons.Hide.

 

Using GridStyleInfo property

GridControl

C#

this.gridControl1.ColStyles[1].CellType = GridCellTypeName.MonthCalendar;
//To hide the dropdown button
this.gridControl1.ColStyles[1].ShowButtons = GridShowButtons.Hide;

VB

Me.gridControl1.ColStyles(1).CellType = GridCellTypeName.MonthCalendar
'To hide the dropdown button
Me.gridControl1.ColStyles(1).ShowButtons = GridShowButtons.Hide

GridGroupingControl

C#

this.gridGroupingControl1.TableDescriptor.Columns["Date"].Appearance.AnyRecordFieldCell.CellType =GridCellTypeName.MonthCalendar;   
//To hide the cell buttons   
this.gridGroupingControl1.TableDescriptor.Columns["Date"].Appearance.AnyRecordFieldCell.ShowButtons = GridShowButtons.Hide

VB

Me.gridGroupingControl1.TableDescriptor.Columns("Date").Appearance.AnyRecordFieldCell.CellType =GridCellTypeName.MonthCalendar
'To hide the cell buttons   
Me.gridGroupingControl1.TableDescriptor.Columns("Date").Appearance.AnyRecordFieldCell.ShowButtons = GridShowButtons.Hide

Using QueryCellStyleInfo event

GridControl

C#

this.gridControl1.ColStyles[1].CellType = GridCellTypeName.MonthCalendar;
//Event Triggering
this.gridGroupingControl1.QueryCellInfo += GridGroupingControl1_QueryCellInfo;
//Event Handling
private void GridGroupingControl1_QueryCellInfo(object sender, Syncfusion.Windows.Forms.Grid.Grouping.GridTableCellInfoEventArgs e)
{
    if(e.RowIndex > 0 && e.ColIndex == 1)
    {
        //To hide the dropdown button.
        e.Style.ShowButtons = GridShowButtons.Hide;
    }
}

VB

Me.gridControl1.ColStyles(1).CellType = GridCellTypeName.MonthCalendar
'Event Triggering
Private Me.gridGroupingControl1.QueryCellInfo += AddressOf GridGroupingControl1_QueryCellInfo
'Event Handling
Private Sub GridGroupingControl1_QueryCellInfo(ByVal sender As Object, ByVal e As Syncfusion.Windows.Forms.Grid.Grouping. GridTableCellInfoEventArgs)
    If e.RowIndex > 0 AndAlso e.ColIndex = 1 Then
        'To hide the dropdown button.
        e.Style.ShowButtons = GridShowButtons.Hide
    End If
End Sub

GridGroupingControl

C#

this.gridGroupingControl1.TableDescriptor.Columns["Date"].Appearance.AnyRecordFieldCell.CellType =GridCellTypeName.MonthCalendar;   
//Event Triggering
this.gridGroupingControl1.QueryCellStyleInfo += GridGroupingControl1_QueryCellStyleInfo;
//Event Handling
private void GridGroupingControl1_QueryCellStyleInfo(object sender, Syncfusion.Windows.Forms.Grid.Grouping.GridTableCellStyleInfoEventArgs e)
{
    if(e.TableCellIdentity.RowIndex > 0 && e.TableCellIdentity.ColIndex == 4)
    {
        //To hide the dropdown button.
        e.Style.ShowButtons = GridShowButtons.Hide;
    }
}

VB

Me.gridGroupingControl1.TableDescriptor.Columns("Date").Appearance.AnyRecordFieldCell.CellType =GridCellTypeName.MonthCalendar
'Event Triggering
Private Me.gridGroupingControl1.QueryCellStyleInfo += AddressOf GridGroupingControl1_QueryCellStyleInfo
'Event Handling
Private Sub GridGroupingControl1_QueryCellStyleInfo(ByVal sender As Object, ByVal e As Syncfusion.Windows.Forms.Grid.Grouping. GridTableCellStyleInfoEventArgs)
    If e.TableCellIdentity.RowIndex > 0 AndAlso e.TableCellIdentity.ColIndex = 4 Then
        'To hide the dropdown button.
        e.Style.ShowButtons = GridShowButtons.Hide
    End If
End Sub

Screenshot

GridControl

Remove the grid cell button in GridControl

GridGroupingControl

Remove the grid cell button in GridGroupingControl

Samples:

GridControl

C#: HideCellButton_CS

VB: HideCellButton_VB

GridGroupingControl

C#: HideCellButton_CS

VB: HideCellButton_VB 

Did you find this information helpful?
Yes
No
Help us improve this page
Please provide feedback or comments
Comments (0)
Please sign in to leave a comment