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

PivotGridControl.CustomGroupInterval Event

Allows you to custom group values of column and row fields.

Namespace: DevExpress.XtraPivotGrid

Assembly: DevExpress.XtraPivotGrid.v19.1.dll


public event PivotCustomGroupIntervalEventHandler CustomGroupInterval

Event Data

The CustomGroupInterval event's data class is PivotCustomGroupIntervalEventArgs. The following properties provide information specific to this event:

Property Description
Field Gets the field being processed. Inherited from PivotFieldEventArgsBase<T>.
GroupValue Gets or sets a group value. Inherited from PivotCustomGroupIntervalEventArgsBase<T>.
Value Gets the processed field value. Inherited from PivotCustomGroupIntervalEventArgsBase<T>.


Values of column and row fields can be grouped into bigger ranges. You can select one of the predefined group modes available with the PivotGridFieldBase.GroupInterval property. If none of these group modes matches your requirements, you can implement custom grouping.

To custom group a field’s values, set the PivotGridFieldBase.GroupInterval property to Custom and handle the CustomGroupInterval event to implement custom grouping logic. The event fires for each value of a field. While handling the event, use the GroupValue parameter to specify the group that will own the currently processed value. For values to be displayed in a single group, provide the same value for the GroupValue parameter.

Objects assigned to the GroupValue property must be of the same type for all values of a particular field.


The CustomGroupInterval is not supported in server and OLAP modes.


This example shows how to provide a custom criteria used to group axis values. The Pivot Grid Control contains two row fields bound to the same ProductName data source field, named Product Group and Product respectively. The custom grouping is applied to the first field and combines the first field’s values by the starting characters of values into three large ranges: A-E, F-S, and T-Z.

The Product Group field’s PivotGridFieldBase.GroupInterval property is set to Custom at design-time. The grouping logic is implemented by handling the PivotGridControl.CustomGroupInterval event.


protected void PivotGridControl_CustomGroupInterval(object sender, 
PivotCustomGroupIntervalEventArgs e) {
    if (e.Field.Caption != "Product Group") return;

    if (Convert.ToChar(e.Value.ToString()[0]) < 'F') {
        e.GroupValue = "A-E";

    if (Convert.ToChar(e.Value.ToString()[0]) > 'E' && 
    Convert.ToChar(e.Value.ToString()[0]) < 'T') {
        e.GroupValue = "F-S";

    if (Convert.ToChar(e.Value.ToString()[0]) > 'S')
        e.GroupValue = "T-Z";
See Also