[Expand]General Information
[Expand]WinForms Controls
[Expand]ASP.NET Controls and MVC Extensions
[Expand]ASP.NET Bootstrap Controls
[Expand]ASP.NET Core Bootstrap Controls
[Collapse]WPF Controls
  Prerequisites
 [Expand]What's Installed
 [Expand].NET Core 3 Support
 [Expand]Common Concepts
 [Expand]MVVM Framework
 [Collapse]Controls and Libraries
   Reporting
  [Collapse]Data Grid
   [Expand]Getting Started
   [Expand]Implementation Details
   [Expand]Views
   [Expand]Grid View Data Layout
   [Expand]Binding to Data
   [Expand]Master-Detail Data Representation
   [Expand]Data Editing and Validation
   [Expand]Grouping
   [Collapse]Filtering and Searching
    [Collapse]Drop-down Filter
      Excel-style Drop-down Filter
      Regular and Checked Drop-down Filters
      Date-time Drop-down Filter
      Custom Drop-down Filter
     Automatic Filter Row
     Filter Editor
     Filter Elements
    [Expand]Filtering in Code
     Predefined Filters
     Data Analysis Filters
     Conditional Formatting Filters
    [Expand]Search
   [Expand]Sorting
   [Expand]Data Summaries
   [Expand]Paging and Scrolling
   [Expand]Focus, Navigation, Selection
   [Expand]Drag-and-Drop
   [Expand]Conditional Formatting
   [Expand]Appearance Customization
   [Expand]MVVM Enhancements
   [Expand]Printing and Exporting
   [Expand]End-User Interaction
   [Expand]Miscellaneous
   [Expand]Performance Improvement
   [Expand]Design-Time Features
   [Expand]Visual Elements
   [Expand]End-User Capabilities
   [Expand]Examples
  [Expand]Ribbon, Bars and Menu
  [Expand]Charts Suite
  [Expand]Pivot Grid
  [Expand]Scheduler
  [Expand]Spreadsheet
  [Expand]Rich Text Editor
  [Expand]Tree List
  [Expand]Gauge Controls
  [Expand]Map Control
  [Expand]Layout Management
  [Expand]Windows Modern UI
  [Expand]Printing-Exporting
  [Expand]Data Editors
  [Expand]Navigation Controls
  [Expand]Spell Checker
  [Expand]Property Grid
  [Expand]PDF Viewer
  [Expand]TreeMap Control
  [Expand]Gantt Control
  [Expand]Diagram Control
  [Expand]Windows and Utility Controls
   Dialogs, Notifications and Panels
  [Expand]Scheduler (legacy)
 [Expand]Scaffolding Wizard
 [Expand]Localization
  Redistribution and Deployment
  Get More Help
 [Expand]API Reference
[Expand]Xamarin Controls
[Expand]Windows 10 App Controls
[Expand]Office File API
[Expand]Reporting
[Expand]Report and Dashboard Server
[Expand]Dashboard
[Expand]eXpressApp Framework
[Expand]eXpress Persistent Objects
[Expand]CodeRush
[Expand]CodeRush Classic
[Expand]Cross-Platform Core Libraries
[Expand]Tools and Utilities
 End-User Documentation
View this topic on docs.devexpress.com (Learn more)

Excel-style Drop-down Filter

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

Tip

Demo: Excel Style Filtering

Requires installation of WPF Subscription. Download

Expanded Enable Excel-style Drop-down Filter

Note

Starting from v18.2, the GridControl supports the FilterPopupMode.ExcelSmart / ColumnFilterPopupMode.ExcelSmart mode. In the previous versions, use the FilterPopupMode.Excel / ColumnFilterPopupMode.Excel mode instead.

Expanded 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.

Expanded Group Filters

Tip

Demos:

Requires installation of WPF Subscription. Download

You can group filter values in the Filter Values tab to allow users to filter data by multiple columns. Set the ColumnBase.FilterPopupGroupFields property to names of the fields by which filter values should be grouped. Separate names by comma, semicolon, or space. The order of field names determines the hierarchy in the group.

Example 1

The code sample below shows how to display the available models below each trademark in the Trademark column's drop-down filter:

The customized column's values are displayed at the root level by default; you can omit its name ("Trademark"). The code sample below has the same effect:

Example 2

The code sample below shows how to display the available models below each trademark in the Model column's drop-down filter:

The customized column's values are not displayed at the root level in this case, its name ("Model") cannot be omitted.

Expanded Conditional Formatting Filters

You can filter data by applying Conditional Formatting rules. The Excel-style Drop-down Filter displays available rules and indicates the number of records that meet rule conditions:

Tip

Demo: Conditional Formatting

Requires a WPF Subscription. Download

Expanded Customize the Excel-style Drop-down Filter

Use the ColumnBase.CustomColumnFilterPopupTemplate property to specify a custom data template. In the template, define a filter element with the PART_FilterElement name and specify its settings.

Customize Filter Popup Content

The following code sample uses the RangeFilterElement as a custom data template:

Customize the Operator List

Standard Operators

Tip

Demo: Excel-Style Drop-Down Filter - Customize the Operator List

Requires installation of WPF Subscription. Download

The Excel-style Drop-down Filter shows a list of operators the selected field accepts. To customize the operator list, use the ExcelStyleFilterElement as a custom data template and handle the ExcelStyleFilterElement.QueryOperators event.

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

Custom Operators

Tip

Demo: Excel-Style Drop-Down Filter - Customize the Operator List

Requires installation of WPF Subscription. Download

You can use the ExcelStyleFilterElement.QueryOperators event to add custom operators. The code sample below adds the Last Years operator:

  1. Create a custom function. Do one of the following:

    • Use the CustomFunctionFactory.Create method.

      The CustomFunctionFactory is an extension of the DevExpress.Xpf.Grid.v19.2.Extensions.dll library. Refer to c:\Program Files (x86)\DevExpress 19.2\Components\Sources\DevExpress.Xpf.Grid\DevExpress.Xpf.Grid.Extensions\ for information on how extension methods work.

      The CustomFunctionFactory.Create method allows you to create a custom function with a maximum of 4 operands.

    • Implement the ICustomFunctionOperator interface. Refer to the Implementing Custom Functions topic for more information.

  2. Call the CriteriaOperator.RegisterCustomFunction method to register the custom function.

  3. Create the ExcelStyleFilterElementOperatorItem and add it to the ExcelStyleFilterElementQueryOperatorsEventArgs.Operators collection. Specify the operator item's edit settings (see BaseEditSettings) to define its operands:

Predefined Filters

Tip

Demo: Excel-Style Drop-Down Filter - Predefined Filters

Requires installation of WPF Subscription. Download

You can specify Predefined Filters with the ColumnBase.PredefinedFilters property. The Excel-style Drop-Down Filter displays these filters in the Filter Rules tab:

Tip

Topic: Predefined Filters

Customize Operand Template

Tip

Demo: Excel-Style Drop-Down Filter - Customize Operands

Requires installation of WPF Subscription. Download

The Excel-style Drop-Down Filter automatically creates operand editors based on the field and operator type. You can customize operand editors.

The following code sample specifies the TrackBarEdit as an operand for the Between and NotBetween operators:

  1. Create a template for the operands. The following models depend on the operator type. Use their properties to bind to operand values in the template:

  2. Handle the ExcelStyleFilterElement.QueryOperators event, get the operator, and assign the created template to the OperatorItemBase.OperandTemplate property.

Is this topic helpful?​​​​​​​