Skip to main content
All docs
V24.1

InfiniteAsyncSource.GetUniqueValuesCommand Property

Gets or sets a command that allows you to get unique values.

Namespace: DevExpress.Xpf.Data

Assembly: DevExpress.Xpf.Core.v24.1.dll

NuGet Package: DevExpress.Wpf.Core

Declaration

public ICommand<GetUniqueValuesAsyncArgs> GetUniqueValuesCommand { get; set; }

Property Value

Type Description
ICommand<GetUniqueValuesAsyncArgs>

A command that allows you to get unique values.

Remarks

Bind a command to the GetUniqueValuesCommand property to maintain a clean MVVM pattern. The command works like a InfiniteAsyncSource.GetUniqueValues event handler and allows you to process unique values in a ViewModel.

You can obtain unique values from a data source field to show them in a column’s drop-down filter. To do this, follow the steps below:

  1. Create a GetUniqueValues command.
  2. Use the PropertyName property to get the field name for which the GridControl collects unique values.
  3. Get a list of unique values and assign it to the Result property.
  4. Bind the command to the InfiniteAsyncSource.GetUniqueValuesCommand / PagedAsyncSource.GetUniqueValuesCommand property.
[Command]
public void GetUniqueValues(GetUniqueValuesAsyncArgs args) {
    if(args.PropertyName == "Priority") {
        var values = Enum.GetValues(typeof(Priority)).Cast<object>().ToArray();
        args.Result = Task.FromResult(values);
    } else {
        throw new InvalidOperationException();
    }
}

Refer to the following help topic for more information: Enable Filter Operations.

The following code snippets (auto-collected from DevExpress Examples) contain references to the GetUniqueValuesCommand property.

Note

The algorithm used to collect these code examples remains a work in progress. Accordingly, the links and snippets below may produce inaccurate results. If you encounter an issue with code examples below, please use the feedback form on this page to report the issue.

See Also