[Expand]General Information
[Collapse]WinForms Controls
  .NET Core Support
 [Expand]What's Installed
 [Expand]Build an Application
 [Collapse]Controls and Libraries
  [Expand]Forms and User Controls
  [Expand]Messages, Notifications, and Dialogs
  [Expand]Editors and Simple Controls
  [Expand]Ribbon, Bars and Menu
  [Expand]Application UI Manager
  [Expand]Docking Library
  [Expand]Data Grid
  [Expand]Vertical Grid
  [Expand]Property Grid
  [Expand]Pivot Grid
  [Collapse]Tree List
   [Expand]Product Information
   [Collapse]Feature Center
    [Expand]Data Binding
    [Expand]Data Editing
    [Expand]Data Presentation
      Filtering in Code
      Classic Style
      Excel Style
      Pop-up Filter Menus
    [Expand]Appearances and Look And Feel
    [Expand]Focus, Selection and Navigation
     Formatting Cell Values
   [Expand]Visual Elements
   [Expand]Design-Time Features
   [Expand]End User Capabilities
   [Expand]Member Tables
  [Expand]Gantt Control
  [Expand]Chart Control
  [Expand]Map Control
  [Expand]Rich Text Editor
  [Expand]Spell Checker
  [Expand]Form Layout Managers
  [Expand]Navigation Controls
  [Expand]PDF Viewer
  [Expand]TreeMap Control
  [Expand]Sunburst Control
 [Expand]Common Features
  Get More Help
 [Expand]API Reference
[Expand]ASP.NET Controls and MVC Extensions
[Expand]ASP.NET Bootstrap Controls
[Expand]ASP.NET Core Bootstrap Controls
[Expand]WPF Controls
[Expand]Xamarin Controls
[Expand]Windows 10 App Controls
[Expand]Office File API
[Expand]Report and Dashboard Server
[Expand]eXpressApp Framework
[Expand]eXpress Persistent Objects
[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

Expanded Overview


Demo Run the XtraTreeList demo to see the filtering functionality in action.

The Excel style menu contains two tabs:

  • The Values tab — allows users to select specific values or value ranges.

    • The tab's UI changes depending on the data type: list, outline view, check box or track bar (you can also specify which UI to use, see below);
    • values can be grouped by multiple columns (see below);
  • the Filters tab — allows users to create a custom filter using comparison operators that match the data type.

    • for example, Between, Greater Than for numbers; Today, Next Week, Last Month, This Year for dates (you can hide specific comparison operators, see below);
    • you can also provide custom filters using a dedicated event (see below).

Expanded Options

The TreeListColumn.OptionsFilter property provides access to filter options that are specific to a particular column.

The TreeList.ShowFilterPopupExcel event fires before the menu is shown for a particular column, and allows you to override the settings.

To determine the column being processed, read the Column event argument. The event arguments allow you to specify the following options

  • DefaultFilterType — the filter type (e.g., Equals, This Quarter, Top N) that is selected when the menu opens;
  • IsRadioMode — gets or sets whether a user can select a single or multiple values at a time;

  • ShowComparisons — gets or sets whether to show the Greater Than, Greater Than Or Equal To, Less Than, Less Than Or Equal To, Between operators.
  • ShowAggregates — for numeric values, gets or sets whether to show the Above Average and Below Average filters;
  • ShowSequences — for numeric values, gets or sets whether to show the Top N and Bottom N filters;
  • ShowBlanks — for text values, gets or sets whether to show the Is Blank and Is Not Blank filters;
  • ShowNulls — for nullable types, gets or sets whether to show the Is Null and Is Not Null filters;

  • ShowCustomFilters — gets or sets whether to show the Custom Filter option that allows a user to combine two comparison operators;
  • ShowPredefinedFilters — gets or sets whether to show the Predefined Filters provided by a dedicated event (see below);
  • ShowLikeFilters — for text values, gets or sets whether to show the pattern-matching (Is Like, Is Not Like) operators.

Expanded How to: Create Custom Filters

If the ShowPredefinedFilters option is enabled, you can display custom filters when a user selects the Predefined Filters option in the Filters tab. To create custom filters, handle the TreeList.FilterPopupExcelData event. For example, to show predefined filters (like those on the figure below), use the following code.

Expanded How to: Add Custom Functions to Pop-up Menus and the Filter Editor

To create a custom filter function (e.g., 'discount is more than 15%'), and add this function to Excel-style pop-up filter menus and the filter editor, do the following:


To add custom functions to filter menus and filter editors of all DevExpress controls in the application, use the static (Shared in VB) CriteriaOperator.QueryCustomFunctions event.

Expanded How to: Filter Data by Multiple Columns from a Single Menu


Demo See the "Task" column's filter menu in the XtraTreeList demo to observe grouped filters in action.

A column's filter menu shows only values available in that column. To filter data by multiple columns, invoke each column's menu.

It is also possible to group filter values in the current column's filter menu by another column. This allows you to filter data for multiple columns from a single menu.

To enable this feature, use the column's TreeListColumn.OptionsFilter.PopupExcelFilterGrouping property (see TreeListOptionsColumnFilter.PopupExcelFilterGrouping). This property specifies data fields (columns) by which you can group filter values in a specific column's filter menu. Data fields (columns) should be specified by their names as strings separated by a comma, semicolon, space or tab character. The code below shows how to display assigned tasks below each employee as illustrated in the figure above.

You can specify two or more data fields (columns) to group filter values by multiple columns. The field name order determines the group hierarchy. To show assigned tasks below each employee in the Task column's filter menu, you can change the group hierarchy using the following code.

As a result, values from the Employee column are shown at the root level.

In the case of a Code First data source, you can annotate data fields with the FilterGroup attribute using the same syntax in the attribute parameter.

Expanded See Also

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