InfiniteAsyncSource.GetUniqueValues Event

Allows you to get unique values.

Namespace: DevExpress.Xpf.Data

Assembly: DevExpress.Xpf.Core.v19.2.dll

Declaration

public event EventHandler<GetUniqueValuesAsyncEventArgs> GetUniqueValues
Public Event GetUniqueValues As EventHandler(Of GetUniqueValuesAsyncEventArgs)

Event Data

The GetUniqueValues event handler receives an argument of the GetUniqueValuesAsyncEventArgs type. The following properties provide information specific to this event:

Property Description
Filter Gets the GridControl's filtering. Inherited from GetUniqueValuesEventArgsBase.
PropertyName Gets the property name. Inherited from GetUniqueValuesEventArgsBase.
Result Gets or sets the result of the get unique values operation (only values).
ResultWithCounts Gets or sets the result of the get unique values operation (values and their counts).

Remarks

Handle the GetUniqueValues event to show unique values in a column's drop-down filter. You can also show counts of these values.

To show only unique values, get a list of these values and specify the GetUniqueValuesAsyncEventArgs.Result property.

To show unique values with their counts, get a list of these values with counts and specify the GetUniqueValuesAsyncEventArgs.ResultWithCounts property.

source.GetUniqueValues += (o, e) => {
    if (e.PropertyName == "User") {
        e.ResultWithCounts = Task.Run(() => {
            return GetIssueDataQueryable().DistinctWithCounts(e.PropertyName);
        });
    } 
    e.Result = Task.Run(() => {
        return GetIssueDataQueryable().Distinct(e.PropertyName);
    });
};

In the code sample above, a data source implements the IQueryable interface. You can use the GridQueryableExtensions.Distinct and GridQueryableExtensions.DistinctWithCounts methods from the DevExpress.Xpf.Grid.19.2.Extensions.dll library to obtain unique values.

NOTE

A complete sample project is available at https://github.com/DevExpress-Examples/how-to-bind-to-iqueryable.

See Also