ColumnView.ActiveFilter Property
Gets an object which represents the filter criteria for the current View.
Namespace: DevExpress.XtraGrid.Views.Base
Assembly: DevExpress.XtraGrid.v19.1.dll
Declaration
[XtraSerializableProperty(XtraSerializationVisibility.Hidden)]
[DXCategory("Behavior")]
public ViewFilter ActiveFilter { get; }
Property Value
Type | Description |
---|---|
ViewFilter | A ViewFilter object representing the filter criteria for the current View. |
Remarks
The ActiveFilter property of the ViewFilter class provides a number of properties which can be used to get details on the current filter criteria applied to the view:
- the indexer (ViewFilter.Item) allows the filter criteria applied to each column in the View to be obtained;
- the ViewFilter.Expression property gets the total filter criteria which is a combination of the columns’ filter criteria. The ColumnView.RowFilter property returns the same value as ViewFilter.Expression;
- the ViewFilter.DisplayText property returns the text representation of ViewFilter.Expression and this is displayed within the View’s filter panel. The ColumnView.FilterPanelText property returns the same value as ViewFilter.DisplayText.
The ActiveFilter property can also be used to apply filtering to a specific column.
To temporarily disable/enable the filter criteria, use the ColumnView.ActiveFilterEnabled property.
For more information, see the Filter and Search document.
Example
The following code shows how to add a filter condition to a View via its ColumnView.ActiveFilter
object. The filter condition selects records whose CategoryName fields start with ‘c’.
using DevExpress.XtraGrid.Views.Base;
using DevExpress.XtraGrid.Columns;
//...
ColumnView view = gridView1;
view.ActiveFilter.Add(view.Columns["CategoryName"],
new ColumnFilterInfo("[CategoryName] Like 'c%'", ""));
Related GitHub Examples
The following code snippet (auto-collected from DevExpress Examples) contains a reference to the ActiveFilter 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.