Back to Devexpress

PercentOfTotalBinding Class

wpf-devexpress-dot-xpf-dot-pivotgrid-620eb395.md

latest4.8 KB
Original Source

PercentOfTotalBinding Class

Allows you to calculate the input of all values in the window as a percentage of the total.

Namespace : DevExpress.Xpf.PivotGrid

Assembly : DevExpress.Xpf.PivotGrid.v25.2.dll

NuGet Package : DevExpress.Wpf.PivotGrid

Declaration

csharp
public class PercentOfTotalBinding :
    CalculationBinding
vb
Public Class PercentOfTotalBinding
    Inherits CalculationBinding

Remarks

Do the following to bind a Pivot Grid field to the result of the calculation in Optimized mode:

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

The example below shows how to use PercentOfTotalBinding to display the percentage of total sales in the Pivot Grid.

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

xaml
<dxpg:PivotGridControl
<!-- ... -->
    DataProcessingEngine="Optimized"
    <!-- ... -->
    <dxpg:PivotGridControl.Fields>
    <!-- ... -->
        <dxpg:PivotGridField
            Area="DataArea"
            AreaIndex="0"
            Caption="Percent of Total"
            CellFormat="P1"
            Name="fieldPercentOfTotal">
            <dxpg:PivotGridField.DataBinding>
                <dxpg:PercentOfTotalBinding PartitioningCriteria="ColumnValueAndRowParentValue">
                    <dxpg:PercentOfTotalBinding.Source>
                        <dxpg:DataSourceColumnBinding ColumnName="Extended Price" />
                    </dxpg:PercentOfTotalBinding.Source>
                </dxpg:PercentOfTotalBinding>
            </dxpg:PivotGridField.DataBinding>
        </dxpg:PivotGridField>
        <!-- ... -->
    </dxpg:PivotGridControl.Fields>
</dxpg:PivotGridControl>

The following code snippet (auto-collected from DevExpress Examples) contains a reference to the PercentOfTotalBinding class.

Note

The algorithm used to collect these code examples remains a work in progress. Accordingly, the links and snippets below may produce inaccurate results. If you encounter an issue with code examples below, please use the feedback form on this page to report the issue.

wpf-pivot-grid-define-custom-cell-template-to-performing-data-editing/CS/HowToEditCell/MainWindow.xaml#L87

xml
<dxpg:PivotGridField.DataBinding>
    <dxpg:PercentOfTotalBinding PartitioningCriteria="ColumnValue">
        <dxpg:PercentOfTotalBinding.Source>

Inheritance

Object DispatcherObject DependencyObject ContentElement FrameworkContentElement DXFrameworkContentElement DataBinding CalculationBinding PercentOfTotalBinding

See Also

PercentOfTotalBinding Members

Optimized Calculation Engine

Window Calculations Overview

Bind Pivot Grid Fields to Window Calculations

DevExpress.Xpf.PivotGrid Namespace