Skip to main content

CustomColumnSortEventArgs Class

Provides data for the ColumnView.CustomColumnSort and GridView.CustomColumnGroup events.

Namespace: DevExpress.XtraGrid.Views.Base

Assembly: DevExpress.XtraGrid.v24.1.dll

NuGet Packages: DevExpress.Win.Grid, DevExpress.Win.Navigation


public class CustomColumnSortEventArgs :


If a column’s GridColumn.SortMode property is set to ColumnSortMode.Custom the View’s data can be sorted and grouped by this column using custom algorithms. To implement custom sorting and (or) grouping logic, handle the ColumnView.CustomColumnSort and GridView.CustomColumnGroup events. The CustomColumnSortEventArgs class provides data for these events.

In an event handler two rows should be compared. For the ColumnView.CustomColumnSort event the result of the custom comparison indicates whether one row should be positioned above or below another row. For the GridView.CustomColumnGroup event the result of the comparison operation should indicate whether the two rows should be combined into the same group. To set the result of the custom comparison use the CustomColumnSortEventArgs.Result property.

The CustomColumnSortEventArgs.ListSourceRowIndex1 and CustomColumnSortEventArgs.ListSourceRowIndex2 properties also refer to the rows being processed. These define the indexes of the rows in the underlying data source. For instance, you can use row indexes when accessing row values using the methods provided by the data source.

In most cases the CustomColumnSortEventArgs.Handled parameter should be set to true to indicate that the comparison operation was handled and therefore no default processing is required. If the parameter is left set to false the default comparison mechanism will be invoked after your event handler has been called and this will override the custom result.


See Also