DataControlBase.CustomUniqueValues Event
In This Article
Allows you to specify unique values displayed in a column’s drop-down filter.
Namespace: DevExpress.WinUI.Grid
Assembly: DevExpress.WinUI.Grid.v23.2.dll
NuGet Package: DevExpress.WinUI
#Declaration
public event CustomUniqueValuesEventHandler CustomUniqueValues
#Event Data
The CustomUniqueValues event's data class is CustomUniqueValuesEventArgs. The following properties provide information specific to this event:
Property | Description |
---|---|
Async |
|
Column |
Gets a column for which the Grid |
Filter | Gets the current filter. |
Handled | Gets or sets whether to populate the drop-down filter with the specified unique values. |
Include |
Gets whether the drop-down filter displays all column values even if they are filtered out. |
Round |
Gets whether to ignore time values when you use the drop-down filter to filter by Date |
Source | Gets the control that raised the event. |
Unique |
Gets or sets unique values. |
Unique |
Gets or sets unique values and their counts. |
Unique |
Gets or sets a task that allows you to asynchronously return unique values and their counts. |
Unique |
Gets or sets a task that allows you to asynchronously return unique values. |
#Remarks
The CustomUniqueValues event occurs before a column’s drop-down filter is populated with unique column values. This event allows you to specify filter values.
<dxg:GridControl ItemsSource="{x:Bind ViewModel.Source}"
AutoGenerateColumns="True"
CustomUniqueValues="grid_CustomUniqueValues"/>
using DevExpress.WinUI.Grid;
using System.Linq;
// ...
void grid_CustomUniqueValues(object sender, CustomUniqueValuesEventArgs e) {
if(e.Column.FieldName != nameof(Product.ProductName))
return;
e.UniqueValues = Products.GetProducts()
.GroupBy(x => x.ProductName)
.Select(x => x.Key)
.ToArray();
}
See Also