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

How to: Split Field Value Cells

  • 3 minutes to read

The following example demonstrates how to split field value cells.In this example, the Grand Total column header is split into two cells: Price and Count. To do this, the CustomFieldValueCells event is handled, and the event parameter's Split method is used. Cells that should be split are identified by a predicate that returns true for those cells. The quantity, size and captions of newly created cells are specified by an array of cell definitions (the FieldValueSplitData objects).

View Example

<Window xmlns:dxpg="http://schemas.devexpress.com/winfx/2008/xaml/pivotgrid" 
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
        xmlns:dx="http://schemas.devexpress.com/winfx/2008/xaml/core" 
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
        x:Class="DXPivotGrid_SplittingCells.Window1" 
        dx:ThemeManager.ThemeName="LightGray" 
        Height="580" Width="1200"
        Loaded="Window_Loaded"
        Title="Window1">
    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto" />
            <RowDefinition Height="*" />
        </Grid.RowDefinitions>
        <dxpg:PivotGridControl Grid.Row="1" Margin="2,2,2,0" Name="pivotGrid" AllowDrag="False"
                               FieldValueDisplayText="pivotGrid_FieldValueDisplayText" 
                               AllowFilter="False"/>
        <GroupBox Grid.Row="0" Height="Auto" Margin="2,2,2,0"
                  Name="groupBox1" VerticalAlignment="Bottom">
            <StackPanel Orientation="Vertical">
                <RadioButton x:Name="rbDefault" IsChecked="True" Content="Default Layout"
                             Margin="0,0,0,2" Checked="rbDefault_Checked"/>
                <RadioButton Checked="rbDefault_Checked" Margin="0,2,0,0"
                             Content="Split Grand Total Column Header"/>
            </StackPanel>
        </GroupBox>
    </Grid>
</Window>