Skip to main content
A newer version of this page is available. .
All docs
V22.1

Bind Pivot Grid Fields to Window Calculations

Pivot Grid uses the Binding API to bind Pivot Grid fields to data. You can use calculated expressions, data source columns, or window calculations as data binding sources.

The sections below describe how to bind a Pivot Grid field to a result of the window calculation in Optimized mode.

The following classes are supported:

Important

You cannot bind the Pivot Grid to data at design time in .NET 5+ projects.

Example

The example below shows how to use RunningTotalBinding to display a cumulative total of the Extended Price field values.

View Example: Pivot Grid Optimized Mode - Field Calculation Data Binding

  1. Create an instance of the RunningTotalBinding class with the Source property set to a DataBinding descendant instance.
  2. Specify the window frame and summary type.
  3. Assign the RunningTotalBinding instance to the PivotGridField.DataBinding property.
<dxpg:PivotGridControl
<!-- ... -->
    DataProcessingEngine="Optimized"
    <!-- ... -->
    <dxpg:PivotGridControl.Fields>
    <!-- ... -->
        <dxpg:PivotGridField
            Area="DataArea"
            AreaIndex="4"
            Caption="Running Total"
            CellFormat="C"
            Name="fieldRunningTotal">
            <dxpg:PivotGridField.DataBinding>
                <dxpg:RunningTotalBinding PartitioningCriteria="ColumnValue" SummaryType="Sum">
                    <dxpg:RunningTotalBinding.Source>
                        <dxpg:DataSourceColumnBinding ColumnName="Extended Price" />
                    </dxpg:RunningTotalBinding.Source>
                </dxpg:RunningTotalBinding>
            </dxpg:PivotGridField.DataBinding>
        </dxpg:PivotGridField>
        <!-- ... -->
    </dxpg:PivotGridControl.Fields>
</dxpg:PivotGridControl>