All docs
V20.2
20.2
20.1
19.2
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.

DataViewBase.SummaryCalculationMode Property

Gets or sets a mode that specifies by which rows the summary value is calculated.

Namespace: DevExpress.Xpf.Grid

Assembly: DevExpress.Xpf.Grid.v20.2.Core.dll

Declaration

public GridSummaryCalculationMode SummaryCalculationMode { get; set; }
Public Property SummaryCalculationMode As GridSummaryCalculationMode

Property Value

Type Description
GridSummaryCalculationMode

A mode that specifies by which rows the summary value is calculated.

Remarks

The GridControl can calculate summaries against selected rows and cells:

Set the DataViewBase.SummaryCalculationMode property to SelectedRows / Mixed to make the GridControl calculate all summaries within its view against selected rows:

<dxg:GridControl x:Name="grid" SelectionMode="Row">
    <dxg:GridControl.View>
        <dxg:TableView x:Name="view"
                       SummaryCalculationMode="SelectedRows"
                       ShowTotalSummary="True" />
    </dxg:GridControl.View>
    <dxg:GridControl.TotalSummary>
        <dxg:GridSummaryItem FieldName="Total" SummaryType="Sum" DisplayFormat="Sum={0:$0.00}" />
    </dxg:GridControl.TotalSummary>
    <dxg:GridControl.GroupSummary>
        <dxg:GridSummaryItem FieldName="Total" SummaryType="Sum" DisplayFormat="Sum={0:$0.00}" />
    </dxg:GridControl.GroupSummary>
</dxg:GridControl> 

Run Demo: Data Grid - Web Style Row Selection

You can create an individual summary for selected rows/cells and set its SummaryItemBase.CalculationMode property to SelectedRows / Mixed:

<dxg:GridControl x:Name="grid" SelectionMode="Row">
    <!-- -->
    <dxg:GridControl.View>
        <dxg:TableView x:Name="view" ShowTotalSummary="True" ShowGroupedColumns="True" />
    </dxg:GridControl.View>
    <dxg:GridControl.TotalSummary>
        <!-- The first summary against selected rows -->
        <dxg:GridSummaryItem FieldName="Total" SummaryType="Sum" ShowInColumn="Total"
                             DisplayFormat="Selection Total=${0:N}" CalculationMode="SelectedRows" />
        <!-- The second summary against all rows -->
        <dxg:GridSummaryItem FieldName="Total" SummaryType="Sum" ShowInColumn="Total" 
                             DisplayFormat="Total=${0:N}" />
    </dxg:GridControl.TotalSummary>
    <dxg:GridControl.GroupSummary>
        <dxg:GridSummaryItem FieldName="Total" SummaryType="Sum" 
                             DisplayFormat="Grand Total=${0:N}" CalculationMode="SelectedRows" />
    </dxg:GridControl.GroupSummary>
</dxg:GridControl> 

Run Demo: Data Grid - Multi Row Selection

NOTE

The GridControl in Server Mode or bound to ICollectionView does not calculate summaries for selection.

See Also