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. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

How to hide (Custom....) option from filter bar dropdown list?

Platform: WinForms |
Control: GridGroupingControl |
Published Date: October 17, 2014 |
Last Revised Date: February 13, 2017

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

 

C#:

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);
        }
    }

VB:

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)
            renderer.ListControlPart.Items.RemoveAt(1)
        End If
    End Sub

Sample:

http://www.syncfusion.com/downloads/support/directtrac/general/HidingOption_FilterBar-682653859.zip

ADD COMMENT
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.

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