wpf-devexpress-dot-xpf-dot-data-dot-infiniteasyncsource-0edb2073.md
Gets or sets a command that allows you to get unique values.
Namespace : DevExpress.Xpf.Data
Assembly : DevExpress.Xpf.Core.v25.2.dll
NuGet Package : DevExpress.Wpf.Core
public ICommand<GetUniqueValuesAsyncArgs> GetUniqueValuesCommand { get; set; }
Public Property GetUniqueValuesCommand As ICommand(Of GetUniqueValuesAsyncArgs)
| Type | Description |
|---|---|
| ICommand<GetUniqueValuesAsyncArgs> |
A command that allows you to get unique values.
|
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:
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.
how-to-bind-to-grpc/CS/InfiniteAsyncSource.GRPC/MainWindow.xaml#L26
GetTotalSummariesCommand="{Binding GetTotalSummariesCommand}"
GetUniqueValuesCommand="{Binding GetUniqueValuesCommand}"/>
</dxg:GridControl.ItemsSource>
wpf-data-grid-bind-to-infiniteasyncsource/CS/InfiniteAsyncSourceMVVMSample/MainWindow.xaml#L24
GetTotalSummariesCommand="{Binding GetTotalSummariesCommand}"
GetUniqueValuesCommand="{Binding GetUniqueValuesCommand}"/>
</dxg:GridControl.ItemsSource>
See Also