Column Sort: put "Null" references to the end

Nov 19, 2008 at 3:37 PM
I am showing a custom class in the column. This class has ToString() & CompareTo().

However, automatic sorting always puts null references ahead of any other values while I need to put those values at the end of the column. How can I do it?
Nov 19, 2008 at 6:36 PM
If your implementation of  IComparable.CompareTo treats null references appropriately (unless your object is convertable to string by casting), DataGrid should sort them appropriately. DataGrid would just use your implementation of IComparable.CompareTo. If you want this behavior only within DataGrid and dont want to change the CompareTo method itself, then you can use the Custom sorting on DataGrid using DataGrid.Sorting event.

Here are the details of custom sorting
Nov 19, 2008 at 6:37 PM
I think you will probably have to implement a custom sorting algorithm to achieve this.  There links to instructions for implementing a custom sort here: