PivotGridGroupCollection Class
Represents a collection of field groups.
Namespace: DevExpress.XtraPivotGrid
Assembly: DevExpress.PivotGrid.v24.2.Core.dll
Declaration
Related API Members
The following members return PivotGridGroupCollection objects:
Remarks
The XtraPivotGrid allows its fields to be arranged into groups. The collection of such groups can be accessed via the PivotGridControl.Groups property. Each group holds the fields in its PivotGridGroup.Fields collection.
PivotGridGroupCollection members allow you to add, remove, access individual groups and, perform other common collection management tasks.
Example
The following example demonstrates how to combine fields into a group.
In the example three fields (‘Country’, ‘Region’ and ‘City’) are combined into a new group in that order. This ensures that the ‘Country’ field will be followed by ‘Region’ which is in turn followed by ‘City’. If the ‘Region’ field is being dragged to another area the other fields will be dragged as well. The following image shows the ‘Region’ field being dragged to the Filter Header Area.
using DevExpress.XtraPivotGrid;
PivotGridField fieldCountry = pivotGridControl1.Fields["Country"];
PivotGridField fieldRegion = pivotGridControl1.Fields["Region"];
PivotGridField fieldCity = pivotGridControl1.Fields["City"];
// Add a new group which combines the fields.
pivotGridControl1.Groups.Add(new PivotGridField[] {fieldCountry, fieldRegion, fieldCity});