Skip to main content

ViewFilter.Add(GridColumn, ColumnFilterInfo) Method

Adds the specified filter criteria to the collection and thus applies them to a View.

Namespace: DevExpress.XtraGrid.Views.Base

Assembly: DevExpress.XtraGrid.v22.2.dll

NuGet Package: DevExpress.Win.Grid


public int Add(
    GridColumn column,
    ColumnFilterInfo filter


Name Type Description
column GridColumn

A GridColumn object representing the column which the specified filter condition is applied to.

filter ColumnFilterInfo

A ColumnFilterInfo object specifying the filter condition applied to the column.


Type Description

A zero-based integer specifying the position at which the filter condition was added amongst the other filter conditions within the current collection. -1 if the given filter condition’s functionality is disabled (its ColumnFilterInfo.Kind property is set to ColumnFilterType.None).


The Add method can be used to add specific filter criteria to a View.

The filter condition represented by the filter parameter will be associated with the specified column. If the current ViewFilter object already contains a filter condition associated with the specified column, the new filter condition will replace the previous one.

Filter conditions within the ViewFilter collection are represented by DevExpress.XtraGrid.Views.Base.ViewColumnFilterInfo objects. ViewColumnFilterInfo merely associates a grid column with a ColumnFilterInfo object.

The Add method creates a new ViewColumnFilterInfo object which refers to the specified column and ColumnFilterInfo object and adds it to the collection. The index of the new element is returned.

Calling the Add method is equivalent to assigning filter criteria to a column via its GridColumn.FilterInfo property.

Note that the ColumnFilterInfo object can define a filter condition involving several columns. For more details on constructing filter conditions, see the Filter and Search topic.


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;
  new ColumnFilterInfo("[CategoryName] Like 'c%'", ""));
See Also