Skip to main content

DevExpress v24.2 Update — Your Feedback Matters

Our What's New in v24.2 webpage includes product-specific surveys. Your response to our survey questions will help us measure product satisfaction for features released in this major update and help us refine our plans for our next major release.

Take the survey Not interested

PivotGridCustomTotalCollection Class

Represents a collection of custom totals.

Namespace: DevExpress.Xpf.PivotGrid

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

NuGet Package: DevExpress.Wpf.PivotGrid

#Declaration

public class PivotGridCustomTotalCollection :
    PivotChildCollection<PivotGridCustomTotal>

The following members return PivotGridCustomTotalCollection objects:

#Remarks

To access the collection of custom totals, use the PivotGridField.CustomTotals property.

To learn more, see Totals.

#Example

The following example demonstrates how to add custom totals for a particular pivot grid field.

In this example, four different totals are added for the Category Name row field: Average, Sum, Min and Max. For this, they should be added to the PivotGridField.CustomTotals property and the PivotGridField.TotalsVisibility property should be set to FieldTotalsVisibility.CustomTotals.

View Example

<Window x:Class="HowToBindToMDB.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:dxpg="http://schemas.devexpress.com/winfx/2008/xaml/pivotgrid"
        Title="MainWindow" Height="350" Width="525"  Loaded="Window_Loaded">
    <Grid>
        <dxpg:PivotGridControl HorizontalAlignment="Left" Name="pivotGridControl1" 
                               VerticalAlignment="Top" RowTotalsLocation="Far">
            <dxpg:PivotGridControl.Fields>
                <dxpg:PivotGridField Name="fieldCategoryName" FieldName="CategoryName" 
                                     Area="RowArea" Caption="Category"
                                     TotalsVisibility="CustomTotals">
                    <dxpg:PivotGridField.CustomTotals>
                        <dxpg:PivotGridCustomTotal SummaryType="Average" />
                        <dxpg:PivotGridCustomTotal SummaryType="Sum" />
                        <dxpg:PivotGridCustomTotal SummaryType="Max" />
                        <dxpg:PivotGridCustomTotal SummaryType="Min" />
                    </dxpg:PivotGridField.CustomTotals>
                </dxpg:PivotGridField>
                <dxpg:PivotGridField Name="fieldProductName" FieldName="ProductName" Area="RowArea"
                                     Caption="Product Name" />
                <dxpg:PivotGridField Name="fieldOrderYear" FieldName="OrderDate" Area="ColumnArea"
                                     Caption="Order Year" GroupInterval="DateYear" />
                <dxpg:PivotGridField Name="fieldExtendedPrice" FieldName="Extended Price"
                                     Area="DataArea" CellFormat="c0" />
            </dxpg:PivotGridControl.Fields>
        </dxpg:PivotGridControl>
    </Grid>
</Window>

#Inheritance

Object
Collection<PivotGridCustomTotal>
ObservableCollection<PivotGridCustomTotal>
DevExpress.Xpf.PivotGrid.Internal.PivotChildCollection<PivotGridCustomTotal>
PivotGridCustomTotalCollection
See Also