Bind Pivot Grid Fields to Window Calculations
The article describes how to use the Binding API to bind a Pivot Grid field to the result of the window calculation when the Pivot Grid uses the Optimized data processing engine.
The following classes are supported:
- RunningTotalBinding
- DifferenceBinding
- RankBinding
- PercentOfTotalBinding
- MovingCalculationBinding
- WindowExpressionBinding
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.
- Create an instance of the
RunningTotalBinding
class with theSource
property set to a DataBinding descendant instance. - Specify the window frame and summary type.
- 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>