Back to Devexpress

How to: Enable Database Storage for User-Defined Criteria that Filter a List View

expressappframework-113143-ui-construction-view-items-and-property-editors-property-editors-use-criteria-property-editors.md

latest2.2 KB
Original Source

How to: Enable Database Storage for User-Defined Criteria that Filter a List View

  • Feb 17, 2026
  • 5 minutes to read

This topic demonstrates how to design and save filter criteria at runtime in an XAF application. The scenario consists of two steps:

  1. Define the FilteringCriterion business class that implements filter criteria for a List View.
  2. Create a custom View Controller that contains an Action used to filter the List View.

Note

To follow the instructions in this topic, you can use the MainDemo.NET application installed with the XAF package. The default location of the application is %PUBLIC%\Documents\DevExpress Demos 25.2\Components\XAF. You can also download the full implementation from the following GitHub page: How to use Criteria Property Editors.

Step 1 - Define the FilteringCriterion Business Class

  1. Add a class to the BusinessObjects folder of the MainDemo.Module project and name it FilteringCriterion.cs. Replace auto-generated code with the following class declaration:

  2. Optional. If you use Entity Framework Core, register the FilteringCriterion type in DbContext:

Step 2 - Create a Custom List View Controller

  1. Add the following CriteriaController class to the Controllers folder of the MainDemo.Module project:

  2. Run the application, create several business objects, and then try the FilteringCriterion action.

See Also

Criteria Properties

Data Annotation Attributes

Data Types of Business Class Properties and Built-in Property Editors

EditorAliases