Skip to main content

GridColumnSummaryItemCollection Class

A column’s total summary collection that can be displayed within the column’s footer.

Namespace: DevExpress.XtraGrid

Assembly: DevExpress.XtraGrid.v24.2.dll

Declaration

[ListBindable(false)]
public class GridColumnSummaryItemCollection :
    GridSummaryItemCollection

The following members return GridColumnSummaryItemCollection objects:

Remarks

You can calculate multiple total summaries for a grid’s column. To add summaries for a column, use the GridColumn.Summary collection. This collection is of the GridColumnSummaryItemCollection type. The collection’s elements are of the GridColumnSummaryItem type. To add items to the collection in code, use the GridColumnSummaryItemCollection.Add method, provided by the GridColumn.Summary collection. At design time, use a collection editor as shown in the image below.

Summary Collection Editor

Total summaries are shown in a View Footer, which is hidden by default. To display it, set the GridOptionsView.ShowFooter option to true.

The image below shows two summaries for the “Units In Stock” column.

GridColumnSummaries

Example

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}"));

Inheritance

Object
CollectionBase
GridSummaryItemCollection
GridColumnSummaryItemCollection
See Also