Skip to main content

How to: Add Multiple Total Summaries for Column

This example demonstrates how to add multiple total summaries for a column at runtime.

Adding Summaries In Code - Result

using DevExpress.XtraGrid;
//...

gridView1.Columns["UnitsInStock"].Summary.Add(new GridColumnSummaryItem(DevExpress.Data.SummaryItemType.Average, "UnitsInStock", "Avg={0:n2}"));
gridView1.Columns["UnitsInStock"].Summary.Add(new GridColumnSummaryItem(DevExpress.Data.SummaryItemType.Sum, "UnitsInStock", "Sum={0}"));
gridView1.Columns["UnitsInStock"].Summary.Add(new GridColumnSummaryItem(DevExpress.Data.SummaryItemType.Max, "UnitsInStock", "Max={0}"));