Implement this method to compare objects given the SortColumn.
It's best to start like this
CopyC#
LIST_ITEM item1 = x as LIST_ITEM; LIST_ITEM item2 = y as LIST_ITEM; if (item1 == null || item2 == null) return 0; if (SortColumn < NumColumns) { // the shell is asked ShellBrowser.SpecialFolder = ShellFolder.Desktop; if (Sorting == SortOrder.Ascending) return ShellBrowser.CompareIDs(item1.RelativeItemIdList, item2.RelativeItemIdList, sortColumn); else return ShellBrowser.CompareIDs(item2.RelativeItemIdList, item1.RelativeItemIdList, sortColumn); } else { // perform a normal alphanumeric compare if (Sorting == SortOrder.Ascending) return item1.SubItems[SortColumn].Text.CompareTo(item2.SubItems[SortColumn].Text); else return item2.SubItems[SortColumn].Text.CompareTo(item1.SubItems[SortColumn].Text); }
Returns a value less than 0 if x is less than y,
0 if x is equal to y and a value greater
than 0 if x is greater than y.