Skip to main content
All docs
V23.2

InfiniteAsyncSource.GetTotalSummariesCommand Property

Gets or sets a command that allows you to get total summaries.

Namespace: DevExpress.Xpf.Data

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

NuGet Package: DevExpress.Wpf.Core

Declaration

public ICommand<GetSummariesAsyncArgs> GetTotalSummariesCommand { get; set; }

Property Value

Type Description
ICommand<GetSummariesAsyncArgs>

A command that allows you to get total summaries.

Remarks

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:

  1. Create a task that uses the Issues Service‘s GetSummariesAsync method to get summaries from a data source.
  2. Use the Summaries property to get the GridControl‘s summary items.
  3. Create a GetTotalSummaries command.
  4. Specify the Result property to return summaries that correspond to the GridControl‘s summary items.
  5. Bind the GetTotalSummaries command to the 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.

See Also