CalculationBindingBase.Source Property
In This Article
Gets or sets a data binding object that provides the data to calculate.
Namespace: DevExpress.PivotGrid.DataBinding
Assembly: DevExpress.PivotGrid.v24.2.Core.dll
NuGet Packages: DevExpress.PivotGrid.Core, DevExpress.Win.Navigation
#Declaration
[DefaultValue(null)]
public DataBindingBase Source { get; set; }
#Property Value
Type | Default | Description |
---|---|---|
Data |
null | A Data |
#Remarks
A Source can be a DataSourceColumnBindingBase descendant that retrieves data from a data source or any other DataBindingBase descendant that provides calculated data.
The following example shows how to create the RunningTotalBinding
calculation binding. The Pivot Grid binds the fieldProductAmountRunningTotal
field to the result of the running total calculation.
- Create an instance of the RunningTotalBinding class with the
Source
property set to the DataBindingBase descendant’s instance. - Specify the window frame and summary type.
- Assign the RunningTotalBinding instance to the PivotGridField.DataBinding property.
pivotGridControl.OptionsData.DataProcessingEngine = PivotDataProcessingEngine.Optimized;
PivotGridField fieldProductAmount = new PivotGridField() {
Area = PivotArea.DataArea,
Caption = "Product Sales",
Name = "fProductAmount"
};
PivotGridField fieldProductAmountRunningTotal = new PivotGridField {
Area = PivotArea.DataArea,
Caption = "Running Total",
Name = "fRunningTotal"
};
DataSourceColumnBinding productAmountBinding = new DataSourceColumnBinding("ProductAmount");
//Bind a field to a column in the data source.
fieldProductAmount.DataBinding = productAmountBinding;
//Calculate a running summary on the column.
fieldProductAmountRunningTotal.DataBinding = new RunningTotalBinding() {
Source = productAmountBinding,
PartitioningCriteria = CalculationPartitioningCriteria.ColumnValue,
SummaryType = PivotSummaryType.Sum
};
pivotGridControl.Fields.AddRange(new PivotGridField[] {
fieldProductAmount,
fieldProductAmountRunningTotal,
});
See Also