Click or drag to resize

JamBaseShellListViewCompare Method

Override this method to compare objects given the SortColumn. The basic implementation compares the items alphabetically. If you need to change this, you can start out like this:
C#
public override int Compare(object x, object y)
{
    ShellListBaseItem item1 = x as ShellListBaseItem;
    ShellListBaseItem item2 = y as ShellListBaseItem;
    if (item1 == null || item2 == null)
        return 0;
    if (!SortColumnShellID.IsCustomId())
    {
        // the shell is asked
        ShellBrowser.SpecialFolder = ShellFolder.Desktop;
        if (Sorting == SortOrder.Ascending)
            return ShellBrowser.CompareIDs(item1.RelativeItemIdList, item2.RelativeItemIdList, m_SortColumnShellIndex);
        else
            return ShellBrowser.CompareIDs(item2.RelativeItemIdList, item1.RelativeItemIdList, m_SortColumnShellIndex);
    }
    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);
    }
}

Namespace:  Jam.Shell
Assembly:  ShellBrowser.Winforms (in ShellBrowser.Winforms.dll) Version: 6.3.1
Syntax
public virtual int Compare(
	Object x,
	Object y
)

Parameters

x
Type: SystemObject
First LIST_ITEM
y
Type: SystemObject
Second LIST_ITEM, which will be compared with first one.

Return Value

Type: Int32
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.

Implements

IComparerCompare(Object, Object)
See Also