wpf-devexpress-dot-xpf-dot-data-dot-infiniteasyncsource-0362995f.md
Gets or sets a command that allows you to get total summaries.
Namespace : DevExpress.Xpf.Data
Assembly : DevExpress.Xpf.Core.v25.2.dll
NuGet Package : DevExpress.Wpf.Core
public ICommand<GetSummariesAsyncArgs> GetTotalSummariesCommand { get; set; }
Public Property GetTotalSummariesCommand As ICommand(Of GetSummariesAsyncArgs)
| Type | Description |
|---|---|
| ICommand<GetSummariesAsyncArgs> |
A command that allows you to get total summaries.
|
Bind a command to the GetTotalSummariesCommand property to maintain a clean MVVM pattern. The command works like a InfiniteAsyncSource.GetTotalSummaries event handler and allows you to process summaries in a ViewModel.
Follow the steps below to process total summaries in the ViewModel:
InfiniteAsyncSource.GetTotalSummariesCommand / PagedAsyncSource.GetTotalSummariesCommand property.[Command]
public void GetTotalSummaries(GetSummariesAsyncArgs args) {
args.Result = GetTotalSummariesAsync(args);
}
static async Task<object[]> GetTotalSummariesAsync(GetSummariesAsyncArgs args) {
var summaryValues = await IssuesService.GetSummariesAsync((IssueFilter)args.Filter);
return args.Summaries.Select(x => {
if(x.SummaryType == SummaryType.Count)
return (object)summaryValues.Count;
if(x.SummaryType == SummaryType.Max && x.PropertyName == "Created")
return summaryValues.LastCreated;
throw new InvalidOperationException();
}).ToArray();
}
For information on how to display total summaries, refer to the following help topic: Display Summaries.
The following code snippets (auto-collected from DevExpress Examples) contain references to the GetTotalSummariesCommand 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-wpf-grid-to-data/CS/ViewModel/EFCore/InfiniteAsyncSource/MainWindow.xaml#L18
<dx:InfiniteAsyncSource ElementType="local_issues:Issue" KeyProperty="Id"
FetchRowsCommand="{Binding FetchRowsCommand}" GetTotalSummariesCommand="{Binding GetTotalSummariesCommand}" />
</dxg:GridControl.ItemsSource>
wpf-data-grid-implement-crud-operations/CS/ViewModel/EFCore/InfiniteAsyncSource/MainWindow.xaml#L35
<dx:InfiniteAsyncSource ElementType="local_issues:Issue" KeyProperty="Id"
FetchRowsCommand="{Binding FetchRowsCommand}" GetTotalSummariesCommand="{Binding GetTotalSummariesCommand}" />
</dxg:GridControl.ItemsSource>
how-to-bind-to-grpc/CS/InfiniteAsyncSource.GRPC/MainWindow.xaml#L25
FetchRowsCommand="{Binding FetchIssuesCommand}"
GetTotalSummariesCommand="{Binding GetTotalSummariesCommand}"
GetUniqueValuesCommand="{Binding GetUniqueValuesCommand}"/>
wpf-data-grid-bind-to-infiniteasyncsource/CS/InfiniteAsyncSourceMVVMSample/MainWindow.xaml#L23
FetchRowsCommand="{Binding FetchIssuesCommand}"
GetTotalSummariesCommand="{Binding GetTotalSummariesCommand}"
GetUniqueValuesCommand="{Binding GetUniqueValuesCommand}"/>
See Also