Visual Basic (Declaration) | |
---|---|
<BrowsableAttribute(False)> Public Property Sorter As IComparer |
Visual Basic (Usage) | Copy Code |
---|---|
|
C# | |
---|---|
[BrowsableAttribute(false)] public IComparer Sorter {get; set;} |
C++/CLI | |
---|---|
[BrowsableAttribute(false)] public: property IComparer^ Sorter { IComparer^ get(); void set (IComparer^ value); } |
Return Value
An IComparer that represents the sorting comparer for the control.This example will create and populate a RasterImageList control with 20 items. It will use a
custom IComparer that implements the Win32 StrCmpLogicalW API to sort the contents of the control.
This example assumes that you have added the code to a Form and call the method created in the example from the
constructor or another method on the form.
Note: This example will only run on Windows XP and Windows 2003 Server.
Visual Basic | Copy Code |
---|---|
Public Sub RasterImageList_Sorter(ByVal imageList As RasterImageList) |
C# | Copy Code |
---|---|
public void RasterImageList_Sorter(RasterImageList imageList) |
The Sorter property allows you to specify the object that performs the sorting of items in the RasterImageList. You can use the Sorter property in combination with the Sort method to perform custom sorting. For example, you could create a class (that implements the IComparer interface) to support custom sorting in the RasterImageList control.
To control the sort order, use the Sorting property.
By default the Sorting algorithm sorts items alphabetically based on the Text property of each list item.
Set the Sorter property to null (Nothing in Visual Basic) to fall back to the default sorter.
Note: Setting the value of the Sorter property causes the Sort method to be called automatically.
Target Platforms: Microsoft .NET Framework 2.0, Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family