A newer version of this page is available. Switch to the current version.

PivotGridGroup Class

Represents an individual group of fields.

Namespace: DevExpress.Xpf.PivotGrid

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

Declaration

public class PivotGridGroup :
    DXFrameworkContentElement,
    IEnumerable,
    IEnumerable<PivotGridField>

Remarks

The DXPivotGrid provides the capability to arrange fields into groups. Fields which are grouped cannot be separated by end-users by dragging one of them to a different area. Field groups are represented by the PivotGridGroup class and are stored within the PivotGridControl.Groups collection.

To learn more, see Field Groups.

Examples

The following example demonstrates how to combine fields into a group.

In this example, three fields (“Country”, “Region” and “City”) are combined in a new group, in this order. This ensures that the “Country” field is followed by “Region”, which is in turn followed by “City”. If the “Region” field is dragged to another area, the other fields accompany it.

NOTE

A complete sample project is available at https://github.com/DevExpress-Examples/how-to-group-fields-e2129.

using System.Windows;
using DevExpress.Xpf.PivotGrid;
using HowToBindToMDB.NwindDataSetTableAdapters;

namespace HowToBindToMDB {
    public partial class MainWindow : Window {
        NwindDataSet.SalesPersonDataTable salesPersonDataTable = 
            new NwindDataSet.SalesPersonDataTable();
        SalesPersonTableAdapter salesPersonDataAdapter = new SalesPersonTableAdapter();
        public MainWindow() {
            InitializeComponent();
            pivotGridControl1.DataSource = salesPersonDataTable;
        }
        private void Window_Loaded(object sender, RoutedEventArgs e) {
            salesPersonDataAdapter.Fill(salesPersonDataTable);

            // Create a group at run-time
            PivotGridGroup group = pivotGridControl1.Groups.Add(fieldCategoryName, fieldProductName);
        }
    }
}
See Also