Skip to main content

PivotGridControl.CustomGroupInterval Event

Allows you to custom group values of a column and a row field.

Namespace: DevExpress.Xpf.PivotGrid

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

NuGet Package: DevExpress.Wpf.PivotGrid

Declaration

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.
GroupValue Gets or sets a group value.
ThreadSafeField Gets the field being processed. Provides read-only access to field settings.
Value Gets the processed field value.

Remarks

Important

This member is not supported in Optimized, OLAP, and Server modes. Use ExpressionDataBinding for Optimized mode instead.

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

To custom group a field’s values, set the PivotGridField.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 PivotCustomGroupIntervalEventArgs.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.

Example

This example shows how to implement custom group intervals in Pivot Grid to group axis values.

View Example

<Window xmlns:dxpg="http://schemas.devexpress.com/winfx/2008/xaml/pivotgrid"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        Title="MainWindow" Height="350" Width="525"
        x:Class="HowToBindToMDB.MainWindow"
        Loaded="Window_Loaded">
    <Grid>
        <dxpg:PivotGridControl DataProcessingEngine="Optimized"
                               HorizontalAlignment="Left" Name="pivotGridControl1"
                               VerticalAlignment="Top">
            <dxpg:PivotGridControl.Fields>
                <dxpg:PivotGridField Name="fieldProductGroup" Area="RowArea"
                                     Caption="Product Group">
                    <dxpg:PivotGridField.DataBinding>
                        <dxpg:ExpressionDataBinding Expression="Iif(Substring([fieldProductName], 0, 1) &lt; 'F', 'A-E', Substring([fieldProductName], 0, 1) &lt; 'T', 'F-S', 'T-Z')" />
                    </dxpg:PivotGridField.DataBinding>
                </dxpg:PivotGridField>
                <dxpg:PivotGridField Name="fieldProductName" Area="RowArea"
                                     Caption="Product Name" >
                    <dxpg:PivotGridField.DataBinding>
                        <dxpg:DataSourceColumnBinding ColumnName="ProductName" />
                    </dxpg:PivotGridField.DataBinding>
                </dxpg:PivotGridField>
                <dxpg:PivotGridField Name="fieldExtendedPrice"
                                     Area="DataArea" CellFormat="c0">
                    <dxpg:PivotGridField.DataBinding>
                        <dxpg:DataSourceColumnBinding ColumnName="Extended Price"/>
                    </dxpg:PivotGridField.DataBinding>
                </dxpg:PivotGridField>
                <dxpg:PivotGridField Name="fieldCountry"
                                     Area="ColumnArea" >
                    <dxpg:PivotGridField.DataBinding>
                        <dxpg:DataSourceColumnBinding ColumnName="Country"/>
                    </dxpg:PivotGridField.DataBinding>
                </dxpg:PivotGridField>
            </dxpg:PivotGridControl.Fields>
        </dxpg:PivotGridControl>
    </Grid>
</Window>

The following code snippet (auto-collected from DevExpress Examples) contains a reference to the CustomGroupInterval event.

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.

See Also