Skip to main content

Total Summary

  • 2 minutes to read

Total Summary Overview

A total summary represents a value of an aggregate function calculated over all data rows displayed within a grid. Total summaries are displayed within the Fixed Summary Panel, provided that the DataControlBase.ShowFixedTotalSummary option is enabled. Summaries displayed within the Fixed Summary Panel are not horizontally scrolled and are always visible onscreen, regardless of the corresponding column’s position and visibility.

grid_totalsummary

Displaying Total Summaries

The grid stores its total summaries within the GridControl.TotalSummary collection.

To create a total summary item at design time, use the TotalSummary Collection Editor.

Total summary items are displayed within the Fixed Summary Panel by default. Use the SummaryItemBase.Alignment property to specify whether to align the summary item to the Left or Right. If this property is set to ‘Default’, a summary item is displayed on the right of the Fixed Summary Panel.

<Grid:GridControl.TotalSummary>
    <Grid:GridSummaryItem FieldName="Total" SummaryType="Max" Alignment="Left" />
</Grid:GridControl.TotalSummary>

To create a total summary in code, create a new instance of the SummaryItemBase class, specify its SummaryItemBase.FieldName and SummaryItemBase.SummaryType properties, and add it to the GridControl.TotalSummary collection.

using DevExpress.Data;
using Windows.UI.Xaml.Controls;

// ...
grid.TotalSummary.Add(SummaryItemType.Count, "ProductName");
grid.TotalSummary.Add(SummaryItemType.Max, "UnitPrice").DisplayFormat = "Max: {0:c2}";
grid.TotalSummary.Add(SummaryItemType.Average, "UnitPrice").DisplayFormat = "Avg: {0:c2}";

Obtaining Summary Values

To obtain a total summary value, use the DataControlBase.GetTotalSummaryValue method.

Use the DataControlBase.FixedSummariesLeft and DataControlBase.FixedSummariesRight properties to obtain total summaries aligned to the Left or to the Right, respectively.