Skip to main content

DataControlBase.FilterCriteria Property

Gets or sets the grid’s filter criteria. This is a dependency property.

Namespace: DevExpress.Xpf.Grid

Assembly: DevExpress.Xpf.Grid.v23.2.Core.dll

NuGet Package: DevExpress.Wpf.Grid.Core


public CriteriaOperator FilterCriteria { get; set; }

Property Value

Type Description

A CriteriaOperator object which represents filter criteria.


Use the FilterCriteria property to create a filter expression that consists of multiple conditions applied to multiple columns, and apply it to the grid. When you set the FilterCriteria property to a new value, GridControl clears any filters that have been previously applied.

You should create a CriteriaOperator object or its descendant representing the filter expression:

grid.FilterCriteria = (
    new BinaryOperator("OrderDate", new DateTime(1995, 1, 1), BinaryOperatorType.Less) &
    new BinaryOperator("UnitPrice", 10, BinaryOperatorType.Less)) |
    ( new BinaryOperator("OrderDate", new DateTime(1996, 1, 1), BinaryOperatorType.GreaterOrEqual) &
    new BinaryOperator("UnitPrice", 100, BinaryOperatorType.GreaterOrEqual));

You can apply filter criteria by parsing a filter string with the static CriteriaOperator.Parse method:

grid.FilterCriteria =
    CriteriaOperator.Parse("([OrderDate] < #1/1/1995# AND [UnitPrice] < 10)" +
    " OR ([OrderDate] >= #1/1/1996# AND [UnitPrice] >= 100)");

FilterString Property

The DataControlBase.FilterString property allows you to specify a filter string:

<dxg:GridControl FilterString="([OrderDate] < #1/1/1995# AND [UnitPrice] < 10) OR ([OrderDate] >= #1/1/1996# AND [UnitPrice] >= 100)" /> 
grid.FilterString = "([OrderDate] < #1/1/1995# AND [UnitPrice] < 10)" +
    " OR ([OrderDate] >= #1/1/1996# AND [UnitPrice] >= 100)";


Use a column’s FieldName value to specify a filter expression with the FilterCriteria / DataControlBase.FilterString property. Refer to the How the GridControl Identifies Columns topic for more information.

Use the DataControlBase.GetColumnFilterCriteria method to obtain a filter applied to a column.

Use the DataControlBase.MergeColumnFilters method to apply a filter to a column(s) preserving the grid’s filter (if applied).

Use the DataControlBase.ClearColumnFilter method to clear the required column’s filter.

End users can modify filters that you set using the FilterCriteria and DataControlBase.FilterString properties. Use the DataControlBase.FixedFilter property to specify a filter criteria that cannot be modified.

The following code snippets (auto-collected from DevExpress Examples) contain references to the FilterCriteria property.


The algorithm used to collect these code examples remains a work in progress. Accordingly, the links and snippets below may produce inaccurate results. If you encounter an issue with code examples below, please use the feedback form on this page to report the issue.

See Also