ColumnView.MRUFiltersInfo Property

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

Namespace: DevExpress.XtraGrid.Views.Base

Assembly: DevExpress.XtraGrid.v20.1.dll

Declaration

[Browsable(false)]
[XtraSerializableProperty(XtraSerializationVisibility.Collection, true, false, true, 1000)]
[XtraSerializablePropertyId(3)]
public ViewFilterInfoCollection MRUFiltersInfo { get; }
<Browsable(False)>
<XtraSerializableProperty(XtraSerializationVisibility.Collection, True, False, True, 1000)>
<XtraSerializablePropertyId(3)>
Public ReadOnly Property MRUFiltersInfo As ViewFilterInfoCollection

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