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:
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())
{
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
{
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.ShellAssembly: ShellBrowser (in ShellBrowser.dll) Version: 7.2
Syntaxpublic virtual int Compare(
Object x,
Object y
)
Public Overridable Function Compare (
x As Object,
y As Object
) As Integer
public:
virtual int Compare(
Object^ x,
Object^ y
)
abstract Compare :
x : Object *
y : Object -> int
override Compare :
x : Object *
y : Object -> int
Parameters
- x Object
- First LIST_ITEM
- y Object
- Second LIST_ITEM, which will be compared with first one.
Return Value
Int32Returns 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