How to remove dropdown button in cell for WinForms GridGroupingControl?
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 WinForms GridGroupingControl. In order to hide the dropdown button of a grid cell,
the ShowButtons property of GridStyleInfo can
be set to GridShowButtons.Hide.
Using the 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 the 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
AddHandler 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
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
AddHandler 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
GridGroupingControl
Samples:
GridControl
GridGroupingControl
Conclusion
I hope you
enjoyed learning about how to remove dropdown button in cells for
GridGroupingControl.
You can refer to WinForms GridGroupingControl feature tour page to know about its other groundbreaking feature representations and WinForms GridGroupingControl documentation, and how to quickly get started for configuration specifications. You can also explore our WinForms GridGroupingControl example to understand how to create and manipulate data.
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!