Skip to main content

DataControlBase.CustomUniqueValues Event

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
AsyncCompleted
Column Gets a column for which the GridControl shows the drop-down filter.
Filter Gets the current filter.
Handled Gets or sets whether to populate the drop-down filter with the specified unique values.
IncludeFilteredOut Gets whether the drop-down filter displays all column values even if they are filtered out.
RoundDateTime Gets whether to ignore time values when you use the drop-down filter to filter by DateTime values.
Source Gets the control that raised the event.
UniqueValues Gets or sets unique values.
UniqueValuesAndCounts Gets or sets unique values and their counts.
UniqueValuesAndCountsAsync Gets or sets a task that allows you to asynchronously return unique values and their counts.
UniqueValuesAsync 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