Back to Devexpress

ColumnView.ShowFilterPopupExcel Event

windowsforms-devexpress-dot-xtragrid-dot-views-dot-base-dot-columnview-7e77d8bb.md

latest8.5 KB
Original Source

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.v25.2.dll

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

Declaration

csharp
[DXCategory("Behavior")]
public event FilterPopupExcelEventHandler ShowFilterPopupExcel
vb
<DXCategory("Behavior")>
Public Event ShowFilterPopupExcel As FilterPopupExcelEventHandler

Event Data

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

PropertyDescription
ColumnGets the grid column being processed. Inherited from FilterPopupEventArgs.
DefaultFilterTypeGets or sets the operator selected by default in the Filters tab.
IsRadioModeGets or sets whether single (the radio mode) or multiple values can be selected simultaneously in the Values tab.
ShowAdvancedDatePeriodsGets or sets whether to show advanced date periods (Year to Date, All Dates in the Period).
ShowAggregatesGets or sets whether to show filters for aggregates (Below Average, Above Average, etc.).
ShowBlanksGets or sets whether to show the IsBlank and IsNotBlank filter conditions.
ShowComparisonsGets or sets whether to show comparison filter conditions (Greater Than, Less Than, etc.).
ShowConditionalFiltersGets or sets whether to display the Conditional Format Filters item in the filter popup.
ShowCustomFiltersGets or sets whether to show the Custom Filters.
ShowDatePeriodsGets or sets whether to show date periods (Specific Date Periods, Today, Last Month, Year to Date, etc.).
ShowFiltersTabGets or sets whether to show the Filters tab.
ShowLikeFiltersGets or sets whether to show the pattern-matching (Is Like, Is Not Like) operators for string values.
ShowNullsGets or sets whether to show the Is Null and Is Not Null filter conditions.
ShowPredefinedFiltersGets or sets whether to show the Predefined Filters option in the Filters tab.
ShowSequencesGets or sets whether to show filters for sequences (Top N, Bottom N, etc.).
ShowTimePeriods

The event data class exposes the following methods:

MethodDescription
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:

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

csharp
void gridView1_ShowFilterPopupExcel(object sender, FilterPopupExcelEventArgs e) {
    e.ShowNulls = false;
}
vb
Private Sub gridView1_ShowFilterPopupExcel(ByVal sender As Object, ByVal e As FilterPopupExcelEventArgs)
    e.ShowNulls = False
End Sub

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

csharp
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);
    }
}
vb
Private Sub gridView1_ShowFilterPopupExcel(ByVal sender As Object, ByVal e As DevExpress.XtraGrid.Views.Grid.FilterPopupExcelEventArgs)
    If e.Column.FieldName = "UnitPrice" Then
        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)
    End If
End Sub

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:

csharp
ExcelFilterOptions.Default.ShowNulls = false;
vb
ExcelFilterOptions.Default.ShowNulls = False

See Also

Filter and Search

ColumnView Class

ColumnView Members

DevExpress.XtraGrid.Views.Base Namespace