PivotGridControl.Groups Property
Gets the collection of field groups.
Namespace: DevExpress.XtraPivotGrid
Assembly: DevExpress.XtraPivotGrid.v18.2.dll
Declaration
[Browsable(false)]
[XtraSerializableProperty(XtraSerializationVisibility.Collection, true, false, true, 100)]
[XtraSerializablePropertyId(3)]
public PivotGridGroupCollection Groups { get; }
Property Value
Type | Description |
---|---|
PivotGridGroupCollection | A PivotGridGroupCollection object which represents a collection of field groups. |
Remarks
Individual fields can be combined into a group which is represented by a PivotGridGroup object. If specific fields belong to a group they are treated as a whole and are always displayed within the same area. An end-user cannot separate these fields by dragging one of them to a different area or hiding it to the Customization Form.
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});
Related GitHub Examples
The following code snippets (auto-collected from DevExpress Examples) contain references to the Groups property.
Note
The algorithm used to collect these code examples remains a work in progress. Accordingly, the links and snippets below may produce inaccurate results. If you encounter an issue with code examples below, please use the feedback form on this page to report the issue.