windowsforms-devexpress-dot-xtragrid-dot-views-dot-base-dot-columnview-e56214ed.md
Gets or sets the current filter criteria.
Namespace : DevExpress.XtraGrid.Views.Base
Assembly : DevExpress.XtraGrid.v25.2.dll
NuGet Packages : DevExpress.Win.Grid, DevExpress.Win.Navigation
[XtraSerializableProperty(XtraSerializationVisibility.Hidden)]
[Browsable(false)]
public CriteriaOperator ActiveFilterCriteria { get; set; }
<XtraSerializableProperty(XtraSerializationVisibility.Hidden)>
<Browsable(False)>
Public Property ActiveFilterCriteria As CriteriaOperator
| Type | Description |
|---|---|
| CriteriaOperator |
A CriteriaOperator object which represents the total filter criteria.
|
You can use the ActiveFilterCriteria property to specify the filter criteria in code, using CriteriaOperator objects. To specify the filter criteria in string format, see the ColumnView.ActiveFilterString property.
The following code demonstrates how to create the following filter criteria via the ColumnView.ActiveFilterCriteria property, using the GroupOperator and BinaryOperator objects:
“[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 });
Imports DevExpress.Data.Filtering
Dim expr1 As CriteriaOperator = New BinaryOperator("Extension", ".gif")
Dim expr2 As CriteriaOperator = New BinaryOperator("Extension", ".png")
gridView1.ActiveFilterCriteria = GroupOperator.Or(New CriteriaOperator() {expr1, expr2})
To temporarily disable the filter, use the ColumnView.ActiveFilterEnabled option.
The ActiveFilterCriteria and ColumnView.ActiveFilterString properties can’t be used to filter data against a field that isn’t represented by a column in the current View.
The ActiveFilterCriteria property is equivalent to the ViewFilter.Criteria property of the ColumnView.ActiveFilter object.
For more information on filtering, see Filter and Search.
The following code snippet (auto-collected from DevExpress Examples) contains a reference 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.
winforms-grid-customize-filter-criteria-before-apply/CS/FilterEvent/Form1.cs#L26
this.GridControl.DataMember = "Orders";
this.GridView.ActiveFilterCriteria = CriteriaOperator.Parse("Freight > 0");
}
winforms-grid-customize-filter-criteria-before-apply/VB/FilterEvent/Form1.vb#L23
GridControl.DataMember = "Orders"
GridView.ActiveFilterCriteria = CriteriaOperator.Parse("Freight > 0")
End Sub
See Also