Log In
[Expand]General Information
[Expand]WinForms Controls
[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
[Collapse]eXpressApp Framework
 [Expand]Getting Started
 [Expand]Design-Time Features
 [Collapse]Task-Based Help
  [Expand]Business Model Design
  [Expand]Application Model
  [Expand]List Editors
  [Expand]Property Editors
    How to: Filter a Link Dialog's List View
    How to: Filter Large List Views using the Auto Filter Row
    How to: Filter List Views on the UI Specific Level
    How to: Implement Cascading Filtering for Lookup List Views
    How to: Use Function Criteria Operators to Filter List Views
  [Expand]Scheduler and Notifications
  [Expand]Miscellaneous UI Customizations
  Frequently Asked Questions (FAQ)
 [Expand]API Reference
[Expand]CodeRush Classic
[Expand]Cross-Platform Core Libraries
[Expand]Tools and Utilities
 End-User Documentation
This documentation page describes implementations made in our v17.2 release cycle. To learn about functionality shipping with v18.1, navigate to our updated help file experience at docs.devexpress.com. Learn More

How to: Use Function Criteria Operators to Filter List Views

The eXpressApp Framework provides various approaches to filter List Views: on data source level, via the Application Model and on the UI specific level. In each of these approaches, you may need to set static variables as filter criteria values. For example, the filter "Task.DueDate must be set to the current date" needs the CurrentDate variable, calculated every time it is required. For this purpose, the use Function Criteria Operators. They represent functions you can use in criteria. In this topic, you will learn how to use these Function Criteria Operators when setting filter criteria for the Task List View. To see a full list of built-in Function Criteria Operators and learn how to implement custom ones, refer to the Function Criteria Operators topic.

Since the technique for using Function Criteria Operators is common to any filtering approach, both in code and the Model Editor, the ListViewFilterAttribute will be chosen for demonstration.


Before reviewing the example, be sure to read the "Important Remark on the DateTime Function Criteria Operators" section of the Function Criteria Operators topic.

Show Me

A complete sample project is available in the DevExpress Code Examples database at http://www.devexpress.com/example=E3936.

The following code demonstrates how to implement various filters using the LocalDateTimeToday, LocalDateTimeLastWeek and LocalDateTimeThisWeek Function Criteria Operators:

The code above generates several Filter child nodes for the Application Model's Views | Task_ListView node:


You could generate these nodes manually in the Model Editor.

The following image demonstrates the Filter Action that contains all the filters provided by the code above:

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