Skip to main content

FieldValueSplitData Class

Represents a cell created when splitting a field value cell.

Namespace: DevExpress.XtraPivotGrid.Data

Assembly: DevExpress.PivotGrid.v24.1.Core.dll

NuGet Packages: DevExpress.PivotGrid.Core, DevExpress.Win.Navigation


public class FieldValueSplitData


The FieldValueSplitData class instances are used when handling the CustomFieldValueCells event. A collection of FieldValueSplitData objects is passed to the event parameter’s Split method. Each element of the collection represents a single cell that should be created after splitting the current one. The entire collection defines how the current cell is split.

The FieldValueSplitData class provides the FieldValueSplitData.NestedCellCount property that defines the size of the newly created cell, and the FieldValueSplitData.Value property that specifies the cell’s value.


The following example shows how to split the field value cells. In this example, the Grand Total column header is split into two cells: Price and Count. For this, the Split method of the CustomFieldValueCells event is used.

View Example: Pivot Grid for WinForms - Split Field Value Cells

using System;
using System.Collections.Generic;
using System.Globalization;
using System.Windows.Forms;
using DevExpress.XtraPivotGrid;
using DevExpress.XtraPivotGrid.Data;

namespace XtraPivotGrid_SplittingCells {
    public partial class Form1 : Form {
        public Form1() {
            pivotGridControl1.CustomFieldValueCells += 
                new PivotCustomFieldValueCellsEventHandler(pivotGrid_CustomFieldValueCells);
        void Form1_Load(object sender, EventArgs e) {
            pivotGridControl1.DataSource = PivotHelper.GetDataTable();
        protected void pivotGrid_CustomFieldValueCells(object sender,
                             PivotCustomFieldValueCellsEventArgs e) {
            PivotGridControl pivot = sender as PivotGridControl;
            if (pivot.DataSource == null) return;
            if (radioGroup1.SelectedIndex == 0) return;

            // Creates a predicate that returns true for the Grand Total headers, 
            // and false for any other column/row header.
            // Only cells that match this predicate are split.
            Predicate<FieldValueCell> condition =
                new Predicate<FieldValueCell>(delegate(FieldValueCell matchCell) {
                return matchCell.ValueType == PivotGridValueType.GrandTotal &&
                    matchCell.Field == null;

            // Creates a list of cell definitions that represent newly created cells.
            // Two definitions are added to the list. The first one identifies the Price cell, 
            // which has two nested cells (the Retail Price and Wholesale Price
            // data field headers). The second one identifies the Count cell with 
            // one nested cell (the Quantity data field header).
            List<FieldValueSplitData> cells = new List<FieldValueSplitData>(2);
            cells.Add(new FieldValueSplitData("Price", 2));
            cells.Add(new FieldValueSplitData("Count", 1));

            // Performs splitting.
            e.Split(true, condition, cells);
        void pivotGridControl1_FieldValueDisplayText(object sender, PivotFieldDisplayTextEventArgs e) {
            PivotGridControl pivot = sender as PivotGridControl;
            if (e.Field == pivot.Fields[PivotHelper.Month])
                e.DisplayText = CultureInfo.CurrentCulture.DateTimeFormat.GetMonthName((int)e.Value);
        void radioGroup1_SelectedIndexChanged(object sender, EventArgs e) {


See Also