GridColumn.Summary Property

Allows you to add multiple total summaries for a column. These summaries are displayed within the View Footer.

Namespace: DevExpress.XtraGrid.Columns

Assembly: DevExpress.XtraGrid.v20.1.dll

Declaration

[XtraSerializableProperty(true, true, true, 1000)]
[XtraSerializablePropertyId(2)]
[DXCategory("Data")]
public GridColumnSummaryItemCollection Summary { get; }
<XtraSerializableProperty(True, True, True, 1000)>
<XtraSerializablePropertyId(2)>
<DXCategory("Data")>
Public ReadOnly Property Summary As GridColumnSummaryItemCollection

Property Value

Type Description
GridColumnSummaryItemCollection

A GridColumnSummaryItemCollection object that is a collection of column total summaries.

Remarks

You can calculate multiple total summaries for a single column via the Summary property. Total summaries, which are calculated against all rows, are displayed in the View Footer. To display the View Footer, use the GridOptionsView.ShowFooter property, accessible via the GridView.OptionsView property.

The Summary object is a collection of summaries. Each summary is a GridColumnSummaryItem object. To add multiple total summaries for a column, you can use the GridColumnSummaryItemCollection.Add method, provided by the Summary object.

You can also add summary items at design time via the grid's summary collection editor. To open the editor, locate the Summary property in the Properties window and click on the ellipsis button.

Summary Collection Editor

Summary Collection Editor 2

An end-user can add multiple summaries for a column at runtime, via the Footer Context Menu. This feature is controlled by the GridOptionsMenu.ShowAddNewSummaryItem property.

If you need to calculate only one summary item for a column, you can use the column's GridColumn.SummaryItem property instead of adding the summary items to the Summary collection. The first element of Summary collection is synchronized with a column's GridColumn.SummaryItem property.

Online Video

WinForms Grid: Multiple Summary Values Under the Same Column.

Examples

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

Adding Summaries In Code - Result

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