All docs
V21.1
21.2 (EAP/Beta)
21.1
20.2
The page you are viewing does not exist in version 20.2. This link will take you to the root page.
20.1
The page you are viewing does not exist in version 20.1. This link will take you to the root page.
19.2
The page you are viewing does not exist in version 19.2. This link will take you to the root page.
19.1
The page you are viewing does not exist in version 19.1. This link will take you to the root page.
18.2
The page you are viewing does not exist in version 18.2. This link will take you to the root page.
18.1
The page you are viewing does not exist in version 18.1. This link will take you to the root page.
17.2
The page you are viewing does not exist in version 17.2. This link will take you to the root page.

InfiniteAsyncSource.GetUniqueValuesCommand Property

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

Namespace: DevExpress.Xpf.Data

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

Declaration

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

Property Value

Type Description
DevExpress.Mvvm.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.

See Also