ColumnView.ActiveFilterCriteria Property
Gets or sets the current filter criteria.
Namespace: DevExpress.XtraGrid.Views.Base
Assembly: DevExpress.XtraGrid.v19.2.dll
Declaration
[XtraSerializableProperty(XtraSerializationVisibility.Hidden)]
[Browsable(false)]
public CriteriaOperator ActiveFilterCriteria { get; set; }
Property Value
Type | Description |
---|---|
CriteriaOperator | A CriteriaOperator object which represents the total filter criteria. |
Remarks
Use the ActiveFilterCriteria property to specify the filter criteria by using a CriteriaOperator object. The property returns the same value as the ViewFilter.Criteria property of the ColumnView.ActiveFilter object. In specific instances you may want to assign the filter criteria by using a filter string. To do this, use the ColumnView.ActiveFilterString property.
Note that the filter can be temporarily disabled by using the ColumnView.ActiveFilterEnabled property.
The ActiveFilterCriteria and ColumnView.ActiveFilterString properties can’t be used to filter data by a field that isn’t represented by a column in the current View.
For more information on filtering, see Filter and Search.
Example
The following code demonstrates how to create filter criteria and assign them to a Grid View via the ColumnView.ActiveFilterCriteria
property.
The criteria is created using the operators defined in the DevExpress.Data.Filtering namespace (the GroupOperator and BinaryOperator classes). The created criteria represent the filter expression: “[Extension] = ‘.gif’ OR [Extension] = ‘.png’”.
using DevExpress.Data.Filtering;
CriteriaOperator expr1 = new BinaryOperator("Extension", ".gif");
CriteriaOperator expr2 = new BinaryOperator("Extension", ".png");
gridView1.ActiveFilterCriteria = GroupOperator.Or(new CriteriaOperator[] { expr1, expr2 });
Related GitHub Examples
The following code snippets (auto-collected from DevExpress Examples) contain references to the ActiveFilterCriteria property.
Note
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.