Method Sort
Sort()
Sorts child items in ascending order.
public virtual void Sort()
Remarks
This method sorts child items using the default comparer. If there are no child items, the method performs no operation.
Sort(IComparer<TreeViewItem>?)
Sorts the child items of the current TreeViewItem using the specified comparer.
public virtual void Sort(IComparer<TreeViewItem>? comparer)
Parameters
comparerIComparer<TreeViewItem>An IComparer<T> implementation used to compare and sort the child items. If
compareris null, the default comparer for TreeViewItem is used.
Remarks
This method has no effect if the current TreeViewItem has no child items.
Sort(int, int, IComparer<TreeViewItem>?)
Sorts a range of child items using the specified comparer.
public virtual void Sort(int index, int count, IComparer<TreeViewItem>? comparer)
Parameters
indexintThe zero-based starting index of the range to sort.
countintThe number of items in the range to sort.
comparerIComparer<TreeViewItem>The IComparer<T> implementation to use when comparing items, or null to use the default comparer.
Remarks
This method sorts the specified range of child items. If there are no items, the method returns without performing any operation.
Sort<T2>(Comparison<T2>)
Sorts child items using the specified comparison.
public virtual void Sort<T2>(Comparison<T2> comparison) where T2 : TreeViewItem
Parameters
comparisonComparison<T2>A delegate that defines the comparison logic to determine the order of the items.
Type Parameters
T2
Remarks
This method has no effect if the current TreeViewItem The comparison delegate is applied to the items to determine their relative order. has no child items.