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 hide option from filter bar dropdown list in WinForms GridGroupingControl?

Platform: WinForms |
Control: GridGroupingControl

Hide the custom option

To remove the (Custom….) option from the FilterBar dropdown list, you need to customize GridListFilterBarCellRenderer using TableControlCurrentCellShowingDropDown, TableControlCurrentCellCloseDropDown events.


private void gridGroupingControl1_TableControlCurrentCellCloseDropDown(object sender, GridTableControlPopupClosedEventArgs e) 
{    GridCurrentCell cc = e.TableControl.CurrentCell;    if ((cc.Renderer.GetType() == GridListFilterBarCellRenderer)) 
    {       GridListFilterBarCellRenderer renderer = ((GridListFilterBarCellRenderer)(cc.Renderer));       if (((renderer.ListControlPart.SelectedIndex >= 1)                         && (renderer.ListControlPart.SelectedIndex                         <= (renderer.ListControlPart.Items.Count - 1)))) 
       {           renderer.ListControlPart.SelectedIndex = (renderer.ListControlPart.SelectedIndex + 1);       }    }}
private void gridGroupingControl1_TableControlCurrentCellShowingDropDown(object sender, GridTableControlCurrentCellShowingDropDownEventArgs e) 
{    GridCurrentCell cc = e.TableControl.CurrentCell;    if ((cc.Renderer.GetType() == GridListFilterBarCellRenderer)) 
    {        GridListFilterBarCellRenderer renderer = ((GridListFilterBarCellRenderer)(cc.Renderer));        GridTableCellStyleInfo tableStyleInfo = ((GridTableCellStyleInfo)(renderer.StyleInfo));        renderer.ListControlPart.Items.RemoveAt(1);    }}



Private Sub gridGroupingControl1_TableControlCurrentCellCloseDropDown(ByVal sender As ObjectByVal As GridTableControlPopupClosedEventArgs)
     Dim cc As GridCurrentCell e.TableControl.CurrentCell
     If (TypeOf cc.Renderer Is GridListFilterBarCellRenderer) Then
        Dim renderer As GridListFilterBarCellRenderer = CType(cc.Renderer,GridListFilterBarCellRenderer)
        If ((renderer.ListControlPart.SelectedIndex >1)  _
           AndAlso (renderer.ListControlPart.SelectedIndex  _
           <(renderer.ListControlPart.Items.Count - 1))) Then
           renderer.ListControlPart.SelectedIndex (renderer.ListControlPart.SelectedIndex + 1)
        End If
     End If
End Sub

Private Sub gridGroupingControl1_TableControlCurrentCellShowingDropDown(ByVal sender As ObjectByVal As GridTableControlCurrentCellShowingDropDownEventArgs)
     Dim cc As GridCurrentCell e.TableControl.CurrentCell
     If (TypeOf cc.Renderer Is GridListFilterBarCellRenderer) Then
        Dim renderer As GridListFilterBarCellRenderer = CType(cc.Renderer,GridListFilterBarCellRenderer)
        Dim tableStyleInfo As GridTableCellStyleInfo = CType(renderer.StyleInfo,GridTableCellStyleInfo)
     End If
End Sub





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