CustomColumnSortEventArgs Class
Provides data for the GridControl.CustomColumnSort event.
Namespace: DevExpress.Xpf.Grid
Assembly: DevExpress.Xpf.Grid.v24.2.dll
NuGet Package: DevExpress.Wpf.Grid.Core
Declaration
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:
<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);
}
See Also