Back to Devexpress

DifferenceBinding Class

windowsforms-devexpress-dot-xtrapivotgrid-d2d52151.md

latest3.7 KB
Original Source

DifferenceBinding Class

Defines the difference calculation between values across a window.

Namespace : DevExpress.XtraPivotGrid

Assembly : DevExpress.XtraPivotGrid.v25.2.dll

NuGet Package : DevExpress.Win.PivotGrid

Declaration

csharp
public class DifferenceBinding :
    DifferenceBindingBase
vb
Public Class DifferenceBinding
    Inherits DifferenceBindingBase

Remarks

To bind a PivotGrid field to the result of the difference window calculations in Optimized mode, do the following:

  1. Create an instance of the DifferenceBinding class.
  2. Set the Source property to the DataBindingBase descendant instance.
  3. Specify the window frame and calculation settings.
  4. Assign the DifferenceBinding instance to the PivotGridField.DataBinding property.

Example

The following code snippet illustrates the use of the Data Binding API to calculate a difference between the preceding and current value in the column:

Run Demo: Optimized Mode - Field Calculation Bindings

csharp
[CodeExampleDataFile("nwind.xml")]
public static void PivotCalculations(PivotGridControl pivotGridControl) {
        productAmountBinding, CalculationPartitioningCriteria.ColumnValue, PivotSummaryType.Average, 1, 1);
    //Calculate a difference between the preceding and current value in the column.
    pivotGridControl.Fields["fDifference"].DataBinding = new DifferenceBinding(
    pivotGridControl.BestFit();
vb
Public Sub PivotCalculations(ByVal pivotGridControl As PivotGridControl)
            Dim productAmountBinding As New DataSourceColumnBinding("ExtendedPrice")
            pivotGridControl.Fields("fDifference").DataBinding = New DifferenceBinding(productAmountBinding, CalculationPartitioningCriteria.ColumnValue, DifferenceTarget.Previous, DifferenceType.Absolute)
        End Sub

Inheritance

Object DataBindingBase CalculationBindingBase DirectedCalculationBindingBase DifferenceBindingBase DifferenceBinding

See Also

DifferenceBinding Members

Optimized Calculation Engine

Bind Pivot Grid Fields to Window Calculations

DevExpress.XtraPivotGrid Namespace