Hide

SftTree/NET 2.0 - Tree Control for Windows Forms

Display
Print

SortDescending Class

Default implementation of an IComparer interface used with the ItemCollectionClass.Sort method to sort items in an descending fashion, based on the cell text in a specified column.

Namespace: Softelvdm.SftTreeNET
Assembly: Softelvdm.SftTreeNET

Inheritance

Syntax

public  sealed class SortDescending;
Public  NotInheritable Class SortDescending

Constructors

PublicSortDescendingInitializes a new instance of the SortDescending class.

Methods

PublicCompareCompares two objects and returns a value indicating whether one is less than, equal to, or greater than the other.
PublicInherited from System.ObjectEqualsDetermines whether the specified object is equal to the current object.
ProtectedInherited from System.ObjectFinalizeAllows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection.
PublicInherited from System.ObjectGetHashCodeServes as the default hash function.
PublicInherited from System.ObjectGetTypeGets the Type of the current instance.
ProtectedInherited from System.ObjectMemberwiseCloneCreates a shallow copy of the current Object.
PublicStaticInherited from System.ObjectReferenceEqualsDetermines whether the specified Object instances are the same instance.
PublicInherited from System.ObjectToStringReturns a string that represents the current object.

Examples

C#

            bool fAscending = SetSorted(e.Cell.ColumnIndex);

            switch (e.Cell.ColumnIndex) {
            default: // column 0 and 1 are sorted based on the Text property
                if (fAscending)
                    sftTree1.ItemCollection.Sort(new SortAscending(e.Cell.ColumnIndex));
                else
                    sftTree1.ItemCollection.Sort(new SortDescending(e.Cell.ColumnIndex));
                break;
            case 2: case 3: // column 2 and 3 are sorted based on the TagObject property, interpreted as a long
                if (fAscending)
                    sftTree1.ItemCollection.Sort(new SortTagObjectAsLongAscending(e.Cell.ColumnIndex));
                else
                    sftTree1.ItemCollection.Sort(new SortTagObjectAsLongDescending(e.Cell.ColumnIndex));
                break;
            }

VB.NET

            sftTree1.ItemCollection.Sort(New SortTagObjectAsLongAscending(e.Cell.ColumnIndex))
        Else
            sftTree1.ItemCollection.Sort(New SortTagObjectAsLongDescending(e.Cell.ColumnIndex))
        End If
    Case Else ' column 0 and 1 are sorted based on the Text property
        If fAscending Then
            sftTree1.ItemCollection.Sort(New SortAscending(e.Cell.ColumnIndex))
        Else
            sftTree1.ItemCollection.Sort(New SortDescending(e.Cell.ColumnIndex))
        End If
    End Select
End Sub

' ItemClick event
Private Sub sftTree1_ItemClick(ByVal sender As Object, ByVal e As Softelvdm.SftTreeNET.ItemClickEventArgs)
    Debug.Write("** ItemClick")

See Also Classes | SftTree/NET 2.0