Skip to main content
A newer version of this page is available. .

RankBinding Class

Defines the calculation of a ranking in the window.

Namespace: DevExpress.XtraPivotGrid

Assembly: DevExpress.XtraPivotGrid.v19.2.dll

Declaration

public class RankBinding :
    RankBindingBase

Remarks

To bind a PivotGrid field to the result of the calculation, perform the following steps:

  1. Create an instance of the RankBinding class with the Source property set to the DataBindingBase descendant instance.
  2. Specify the window frame.
  3. Assign the RankBinding instance to the PivotGridField.DataBinding property.

Example

The following code snippet illustrates the use of the Data Binding API:

Note

The complete sample project is available in the DevExpress Demo Center: Code Examples - Optimized Mode - Field Calculation Bindings module in the XtraPivotGrid MainDemo.

pivotGridControl.OptionsData.DataProcessingEngine = PivotDataProcessingEngine.Optimized;

PivotGridField fieldProductAmount = new PivotGridField()
{
    Area = PivotArea.DataArea,
    Caption = "Product Sales",
    Name = "fProductAmount"
};

PivotGridField fieldProductAmountRank = new PivotGridField()
{
    Area = PivotArea.DataArea,
    Caption = "Rank",
    Name = "fRank"

};
DataSourceColumnBinding productAmountBinding = new DataSourceColumnBinding("ProductAmount");
//Bind a field to a column in the data source.
fieldProductAmount.DataBinding = productAmountBinding;
//Calculate a rank for each value in the column in a pivot field group.
fieldProductAmountRank.DataBinding = new RankBinding()
{
    Source = productAmountBinding,
    PartitioningCriteria = CalculationPartitioningCriteria.ColumnValueAndRowParentValue,
    RankType = RankType.Unique,
    Order = PivotSortOrder.Descending
};
pivotGridControl.Fields.AddRange(new PivotGridField[] {
    fieldProductAmount,
    fieldProductAmountRank
});
See Also