Step 4: Display Summaries

  • 2 min to read

You should enable data operations after binding the GridControl to a virtual source.

In this step, we describe how to display summaries:

  • You process summaries in the virtual source.
  • Then you display summaries in the GridControl.



The Issues Service is used as an example of a data source in this tutorial.


The Issues Service can get:

  • A total count of rows.
  • The last created object's datetime.
public class IssuesSummaries {   
    public int Count { get; private set; }
    public DateTime? LastCreated { get; private set; }

To Display Summaries

  1. Process summaries in the virtual source:

    source.GetTotalSummaries += (o, e) => {
        e.Result = GetTotalSummariesAsync(e);
    static async Task<object[]> GetTotalSummariesAsync(GetSummariesAsyncEventArgs e) {
        IssueFilter filter = MakeIssueFilter(e.Filter);
        var summaryValues = await IssuesService.GetSummariesAsync(filter);
        return e.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();
  2. Set the DataViewBase.ShowFixedTotalSummary property to true to show the Fixed Summary Panel:

    <dxg:TableView ShowFixedTotalSummary="True" />
  3. Display total summaries in the GridControl by specifying the GridControl.TotalSummary property:

        <dxg:GridSummaryItem SummaryType="Count" Alignment="Right"/>
        <dxg:GridSummaryItem SummaryType="Max" FieldName="Created" DisplayFormat="{}Last created: {0}" Alignment="Right"/>

To Continue or Review