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

CustomColumnSortEventArgs Class

Provides data for the GridControl.CustomColumnSort event.

Namespace: DevExpress.Xpf.Grid

Assembly: DevExpress.Xpf.Grid.v21.2.dll

NuGet Package: DevExpress.Wpf.Grid.Core

Declaration

public class CustomColumnSortEventArgs :
    EventArgs

Remarks

To learn more, see Sorting Modes and Custom Sorting.

Example

The following example demonstrates how to use custom rules to sort data in the GridControl:

DevExpress WPF | Grid Control - Custom Sort Rules

View Example: How to Use Custom Rules to Sort Data

<dxg:GridControl x:Name="grid"
                 CustomColumnSort="OnCustomColumnSort">
    <dxg:GridControl.Columns>
        <dxg:GridColumn FieldName="Day" GroupIndex="0" SortMode="Custom"/>
        <dxg:GridColumn FieldName="Employee"/>
    </dxg:GridControl.Columns>
</dxg:GridControl>
void OnCustomColumnSort(object sender, CustomColumnSortEventArgs e) {
    if(e.Column.FieldName == "Day") {
        int dayIndex1 = GetDayIndex(e.Value1);
        int dayIndex2 = GetDayIndex(e.Value2);
        e.Result = dayIndex1.CompareTo(dayIndex2);
        e.Handled = true;
    }
}
int GetDayIndex(object day) {
    return (int)Enum.Parse(typeof(DayOfWeek), (string)day);
}

Inheritance

Object
EventArgs
CustomColumnSortEventArgs
See Also