Skip to main content

Excel-style Drop-down Filter

  • 2 minutes to read

The GridControl includes an Excel-style drop-down filter:

WinUI Grid - Excel Filter

The GridControl shows the Excel-style drop-down filter if the ColumnBase.FilterPopupMode is set to Excel or Default.

Excel-style Drop-down Filter Elements

The Filter Rules tab shows a list of operators the selected column accepts. A user should select an operator and specify operand values.

The Filter Values tab shows an Excel-style checklist with the filter values. Record counts are displayed next to the filter values. The built-in search panel allows users to find filter values.

WinUI Grid - Excel Filter Elements

Group Filters

You can group column values in the Filter Values tab to allow users to filter data by multiple columns. Set the ColumnBase.FilterPopupGroupFields property to field names of the values you want to group. These field names should be separated by a comma, semicolon, or space. The order of field names determines the hierarchy in the group.

WinUI Grid - Grouped Filters

<dxg:GridControl.Columns>
    <dxg:GridTextColumn FieldName="ProductName" FilterPopupGroupFields="Country; ProductName"/>
    <dxg:GridComboBoxColumn FieldName="Country"/>
    <!-- ... -->
</dxg:GridControl.Columns>

Customize the Operator List

The Excel-style drop-down filter shows a list of operators that the selected field accepts. To customize the operator list, use properties listed below. These properties allow you to specify filters supported by the GridControl‘s columns:

ColumnBase.AllowedUnaryFilters
Gets or sets unary filters that the GridControl‘s column supports.
ColumnBase.AllowedBinaryFilters
Gets or sets binary filters that the GridControl‘s column supports.
ColumnBase.AllowedAnyOfFilters
Gets or sets any of filters that the GridControl‘s column supports.
ColumnBase.AllowedDateTimeFilters
Gets or sets date-time filters that the GridControl‘s column supports.
ColumnBase.AllowedBetweenFilters
Gets or sets between filters that the GridControl‘s column supports.

The code sample below removes all operators except Equal and Not Equal:

WinUI Grid - Customize the Operator List

<dxg:GridSpinEditColumn FieldName="UnitPrice" 
                        AllowedBinaryFilters="Equals, DoesNotEqual" 
                        AllowedBetweenFilters="None"/>