Skip to main content

ColumnView.MRUFiltersInfo Property

Provides access to the recently applied filters list (see MRU Filter List article).

Namespace: DevExpress.XtraGrid.Views.Base

Assembly: DevExpress.XtraGrid.v24.1.dll

NuGet Packages: DevExpress.Win.Grid, DevExpress.Win.Navigation

Declaration

[Browsable(false)]
[XtraSerializableProperty(XtraSerializationVisibility.Collection, true, false, true, 1000)]
[XtraSerializablePropertyId(3)]
public ViewFilterInfoCollection MRUFiltersInfo { get; }

Property Value

Type Description
DevExpress.XtraGrid.Views.Base.ViewFilterInfoCollection

A list of recently applied view filters.

Remarks

The code below illustrates how to add two filters to the view’s MRU filter list. Each filter is composite and consists of two expressions. The currently applied filter is assigned with the ColumnView.ActiveFilterString property.

MRU

//filter 1
//part 1
ViewFilterColumnInfo customFilterDate = new ViewFilterColumnInfo();
customFilterDate.ColumnName = "colOrderDate";
customFilterDate.FilterString = "IsOutlookIntervalLastWeek([OrderDate])";
customFilterDate.Type = DevExpress.XtraGrid.Columns.ColumnFilterType.Custom;
//part 2
ViewFilterColumnInfo customFilterCountry = new ViewFilterColumnInfo();
customFilterCountry.ColumnName = "colShipCountry";
customFilterCountry.FilterString = "[ShipCountry] = 'USA'";
customFilterCountry.Type = DevExpress.XtraGrid.Columns.ColumnFilterType.Custom;
//combine parts
ViewFilterInfo CustomMruFilter1 = new ViewFilterInfo();
CustomMruFilter1.ColumnsFilter.Add(customFilterDate);
CustomMruFilter1.ColumnsFilter.Add(customFilterCountry);

//filter 2
//part 1
ViewFilterColumnInfo customFilterDate2 = new ViewFilterColumnInfo();
customFilterDate2.ColumnName = "colOrderDate";
customFilterDate2.FilterString = "IsThisMonth([OrderDate])";
customFilterDate2.Type = DevExpress.XtraGrid.Columns.ColumnFilterType.Custom;
//part 2
ViewFilterColumnInfo customFilterCountry2 = new ViewFilterColumnInfo();
customFilterCountry2.ColumnName = "colShipCountry";
customFilterCountry2.FilterString = "[ShipCountry] = 'Canada'";
customFilterCountry2.Type = DevExpress.XtraGrid.Columns.ColumnFilterType.Custom;
//combine parts
ViewFilterInfo CustomMruFilter2 = new ViewFilterInfo();
CustomMruFilter2.ColumnsFilter.Add(customFilterDate2);
CustomMruFilter2.ColumnsFilter.Add(customFilterCountry2);

gridView1.ActiveFilterString = "[ShipCity] = 'London'";
gridView1.MRUFiltersInfo.Add(CustomMruFilter1);
gridView1.MRUFiltersInfo.Add(CustomMruFilter2);
See Also