FilterBehavior.CustomUniqueValues Event
Allows you to specify unique values displayed within a filter element.
Namespace: DevExpress.Xpf.Core.FilteringUI
Assembly: DevExpress.Xpf.Grid.v24.2.dll
NuGet Package: DevExpress.Wpf.Grid.Core
Declaration
Event Data
The CustomUniqueValues event's data class is CustomUniqueValuesEventArgs. The following properties provide information specific to this event:
Property | Description |
---|---|
CountedValues | Gets or sets unique filter values with their counts. |
FieldName | Gets a name of the field. |
Filter | Gets the current filter criteria specified in the Filter Editor / Filter Element. |
Values | Gets or sets unique filter values. |
Remarks
<dxfui:FilterBehavior x:Name="filterBehavior" ItemsSource="{x:Type local:ProductInfo}"
CustomUniqueValues="filterBehavior_CustomUniqueValues" />
void filterBehavior_CustomUniqueValues(object sender, CustomUniqueValuesEventArgs e) {
if(e.FieldName != "CategoryName")
throw new InvalidOperationException();
e.CountedValues = GetCategoryUniqueValues();
}
internal IList<CountedValue> GetCategoryUniqueValues() {
return GetProductsQueryCore()
.GroupBy(x => x.CategoryName)
.Select(x => new { x.Key, Count = x.Count() })
.ToList()
.Select(x => new CountedValue(x.Key, x.Count))
.ToList();
}
See Also