Skip to main content

ColumnView.ShowFilterPopupExcel Event

Allows you to hide specific filter conditions from Filters and Values tabs of the Excel-style Drop-down Filter.

Namespace: DevExpress.XtraGrid.Views.Base

Assembly: DevExpress.XtraGrid.v24.1.dll

NuGet Packages: DevExpress.Win.Grid, DevExpress.Win.Navigation

Declaration

[DXCategory("Behavior")]
public event FilterPopupExcelEventHandler ShowFilterPopupExcel

Event Data

The ShowFilterPopupExcel event's data class is FilterPopupExcelEventArgs. The following properties provide information specific to this event:

Property Description
Column Gets the grid column being processed. Inherited from FilterPopupEventArgs.
DefaultFilterType Gets or sets the operator selected by default in the Filters tab.
IsRadioMode Gets or sets whether single (the radio mode) or multiple values can be selected simultaneously in the Values tab.
ShowAdvancedDatePeriods Gets or sets whether to show advanced date periods (Year to Date, All Dates in the Period).
ShowAggregates Gets or sets whether to show filters for aggregates (Below Average, Above Average, etc.).
ShowBlanks Gets or sets whether to show the IsBlank and IsNotBlank filter conditions.
ShowComparisons Gets or sets whether to show comparison filter conditions (Greater Than, Less Than, etc.).
ShowCustomFilters Gets or sets whether to show the Custom Filters.
ShowDatePeriods Gets or sets whether to show date periods (Specific Date Periods, Today, Last Month, Year to Date, etc.).
ShowFiltersTab Gets or sets whether to show the Filters tab.
ShowLikeFilters Gets or sets whether to show the pattern-matching (Is Like, Is Not Like) operators for string values.
ShowNulls Gets or sets whether to show the Is Null and Is Not Null filter conditions.
ShowPredefinedFilters Gets or sets whether to show the Predefined Filters option in the Filters tab.
ShowSequences Gets or sets whether to show filters for sequences (Top N, Bottom N, etc.).

The event data class exposes the following methods:

Method Description
HideFilter(CustomUIFilterType) Hides an operator from the Filters tab.

Remarks

The ShowFilterPopupExcel event allows you to hide specific predefined conditions from the Filters tab of the Excel-style Drop-down Filter. For instance, this tab contains the Is Null and Is Not Null filter conditions:

ColumnView_ShowFilterPopupExcel

The following code snippet hides these conditions from the Filters tab:

ColumnView_ShowFilterPopupExcel_HideNulls

void gridView1_ShowFilterPopupExcel(object sender, FilterPopupExcelEventArgs e) {
    e.ShowNulls = false;
}

You can use the e.HideFilter method to hide specific conditions:

WinForms Grid - Hide Operators from the Excel Filter

void gridView1_ShowFilterPopupExcel(object sender, DevExpress.XtraGrid.Views.Grid.FilterPopupExcelEventArgs e) {
    if (e.Column.FieldName == "UnitPrice") {
        e.HideFilter(DevExpress.Utils.Filtering.Internal.CustomUIFilterType.BelowAverage);
        e.HideFilter(DevExpress.Utils.Filtering.Internal.CustomUIFilterType.Between);
        e.HideFilter(DevExpress.Utils.Filtering.Internal.CustomUIFilterType.BottomN);
        e.HideFilter(DevExpress.Utils.Filtering.Internal.CustomUIFilterType.Custom);
        e.HideFilter(DevExpress.Utils.Filtering.Internal.CustomUIFilterType.DoesNotEqual);
        e.HideFilter(DevExpress.Utils.Filtering.Internal.CustomUIFilterType.InRange);
        e.HideFilter(DevExpress.Utils.Filtering.Internal.CustomUIFilterType.LessThan);
        e.HideFilter(DevExpress.Utils.Filtering.Internal.CustomUIFilterType.LessThanOrEqualTo);
    }
}

Instead of the ShowFilterPopupExcel event, you can also use related static properties accessible through the DevExpress.Utils.Filtering.ExcelFilterOptions.Default field. These properties allow you to hide filter conditions for all Data Grid controls in the application:

ExcelFilterOptions.Default.ShowNulls = false;
See Also