All docs
V20.1
20.1
19.2
The page you are viewing does not exist in version 19.2. This link will take you to the root page.
19.1
The page you are viewing does not exist in version 19.1. This link will take you to the root page.
18.2
The page you are viewing does not exist in version 18.2. This link will take you to the root page.
18.1
The page you are viewing does not exist in version 18.1. This link will take you to the root page.
17.2
The page you are viewing does not exist in version 17.2. This link will take you to the root page.

GridSummaryItem.Mode Property

Gets or sets whether the current summary is calculated against all rows or the selection. This property makes sense when you enable multiple row selection (see ColumnView.OptionsSelection.MultiSelect).

Namespace: DevExpress.XtraGrid

Assembly: DevExpress.XtraGrid.v20.1.dll

Declaration

[DefaultValue(SummaryMode.AllRows)]
[XtraSerializableProperty(2)]
[DXCategory("Behavior")]
public virtual SummaryMode Mode { get; set; }
<DefaultValue(SummaryMode.AllRows)>
<XtraSerializableProperty(2)>
<DXCategory("Behavior")>
Public Overridable Property Mode As SummaryMode

Property Value

Type Default Description
SummaryMode

AllRows

A value that specifies whether the current summary is calculated against all rows or the selection.

Remarks

In multiple row selection mode (see ColumnView.OptionsSelection.MultiSelect), summaries are initially calculated against all rows. To calculate summaries against the selected rows, set the GridSummaryItem.Mode property to SummaryMode.Selection or SummaryMode.Mixed.

using DevExpress.Data;
using DevExpress.XtraGrid;

gridView1.OptionsView.ShowFooter = true;
gridView1.OptionsSelection.MultiSelect = true;
colOrderID.Summary.AddRange(new GridSummaryItem[] {new GridColumnSummaryItem(SummaryItemType.Count, SummaryMode.Selection, "OrderID", "COUNT={0}")});

The Data Grid conrol uses a special icon to indicate summaries calculated against a subset of rows:

For summaries calculated against all rows, the Data Grid does not use any additional icon.

SummaryMode.AllRows - Calculate a summary against all rows.

SummaryMode.Selection and SummaryMode.Mixed - Calculate a summary against the selection.

The difference between 'Selection' and 'Mixed' modes is noticable when you select a single data row. The summary is calculated against the selected row in 'Selection' mode, and against all rows in 'Mixed' mode.

NOTE

You can allow a user to select multiple cells by setting the GridView.OptionsSelection.MultiSelectMode property to CellSelect. The Data Grid, however, will calculate summaries against the rows that contain the selected cells, but not against these individual cells.

Data Grouping

When the Data Grid groups rows, the 'Selection' and 'Mixed' summary modes allow you to see summaries calculated against groups of rows. When you select one or more group rows, the summary is calculated across all children of the selected groups.

If you select a data row(s) within a group, the summary ignores non-selected rows in this group.

Change Summary Mode at Runtime

Enable the GridOptionsMenu.ShowSummaryItemMode option to allow users to specify summary mode at runtime via a context menu.

See Also