A newer version of this page is available. Switch to the current version.

ColumnView.ActiveFilterCriteria Property

Gets or sets the current filter criteria.

Namespace: DevExpress.XtraGrid.Views.Base

Assembly: DevExpress.XtraGrid.v18.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.

Examples

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 });
See Also