The requested page is not available for the requested platform. You are viewing the content for Default platform.

GridControl.CustomColumnGroup Event

Provides the capability to group data using custom rules.

Namespace: DevExpress.UI.Xaml.Grid

Assembly: DevExpress.UI.Xaml.Grid.v18.2.dll

Declaration

public event CustomColumnSortEventHandler CustomColumnGroup
Public Event CustomColumnGroup As CustomColumnSortEventHandler

Event Data

The CustomColumnGroup event handler receives an argument of the CustomColumnSortEventArgs type. The following properties provide information specific to this event.

Property Description
Column Gets the column whose values are being compared.
Handled Gets or sets whether a comparison operation is handled and no default processing is required.
ListSourceRowIndex1 Gets the index of the first of the two rows being compared in the data source.
ListSourceRowIndex2 Gets the index of the second of the two rows being compared in the data source.
Result Gets or sets the result of a custom comparison.
SortOrder Gets the sort order applied to the column.
Source Gets the grid control that raised the event.
Value1 Gets the first value being compared.
Value2 Gets the second value being compared.

Remarks

If the built-in grouping modes don't suit your requirements, you can implement custom logic. To do this, set the ColumnBase.SortMode property to 'Custom', and handle the CustomColumnGroup event. To change the text displayed within group rows by default, handle the GridControlBase.CustomGroupDisplayText event.

Examples

This example shows how to group rows using custom rules. When grouping by the 'Unit Price' column, the rows in this column that have values between 0 and 10 should be combined into a single group. Rows whose values fall between 10 and 20 should be combined into another group, etc.

<Page
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:local="using:HowToCustomGrouping"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    xmlns:Grid="using:DevExpress.UI.Xaml.Grid"
    x:Class="HowToCustomGrouping.MainPage"
    mc:Ignorable="d">
    <Grid>
        <Grid:GridControl Name="grid" CustomColumnGroup="GridControl_CustomColumnGroup" CustomGroupDisplayText="GridControl_CustomGroupDisplayText" Background="Black" Foreground="White" >
            <Grid:GridControl.Columns>
                <Grid:GridTextColumn FieldName="ProductName" />
                <Grid:GridTextColumn FieldName="Supplier" />
                <Grid:GridTextColumn FieldName="UnitPrice" SortMode="Custom"/>
                <Grid:GridTextColumn FieldName="Quantity" />
            </Grid:GridControl.Columns>
        </Grid:GridControl>
    </Grid>
</Page>
See Also