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

CustomColumnSortEventArgs.Result Property

Gets or sets the result of a custom comparison.

Namespace: DevExpress.XtraGrid.Views.Base

Assembly: DevExpress.XtraGrid.v19.2.dll

Declaration

public int Result { get; set; }

Property Value

Type Description
Int32

An integer value specifying the custom comparison’s result.

Remarks

Use the Result property to set the result of the custom comparison of the two rows being processed. The values of the rows within the column being processed are specified by the CustomColumnSortEventArgs.Value1 and CustomColumnSortEventArgs.Value2 properties.

These rows can be identified by the CustomColumnSortEventArgs.ListSourceRowIndex1 and CustomColumnSortEventArgs.ListSourceRowIndex2 properties.

When handling the ColumnView.CustomColumnSort event the result of the custom comparison operation must be set as follows:

  • set Result to -1 if the first row should be positioned above the second row when data is sorted in ascending order. When data is sorted in descending order the first row will be positioned below the second row.
  • set Result to 1 if the first row should be positioned below the second row when data is sorted in ascending order. When data is sorted in descending order the first row will be positioned above the second row
  • set Result to 0 to indicate that the rows are equal. In this case the rows will be arranged within the View according to their indexes in the data source.

When handling the GridView.CustomColumnGroup event the result of the custom comparison operation should be set as follows:

  • set Result to 0 to indicate that the rows should be combined into the same group.
  • set Result to 1 (or -1) to indicate that the rows should be placed within different groups.

Note: the CustomColumnSortEventArgs.Handled property should be set to true to indicate that the current comparison operation has been handled and that the default processing isn’t required. If this parameter is left set to false the default comparison mechanism will be invoked after your ColumnView.CustomColumnSort (or GridView.CustomColumnGroup) event handler is called and this will override the custom result.

The following code snippets (auto-collected from DevExpress Examples) contain references to the Result property.

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