System.Windows.Forms.TreeView.Sort Method

Sorts the items in System.Windows.Forms.TreeView control.

Syntax

public void Sort ()

Remarks

This method reapplies the default sort, which is alphabetical by node text, or a custom sort specified by the TreeView.TreeViewNodeSorter property. You can use this method if the text of existing nodes is changed or nodes are moved by the user, and you want to sort the items again.

Note:

The default sorter uses the System.Globalization.CompareInfo.Compare(string, int, int, string, int, int) method based on the Application.CurrentCulture specified by the application. This means that System.Windows.Forms.TreeNode objects with equal value are kept in the order in which they were added to the System.Windows.Forms.TreeView control. This behavior may be different if a custom sort is applied.

Requirements

Namespace: System.Windows.Forms
Assembly: System.Windows.Forms (in System.Windows.Forms.dll)
Assembly Versions: 2.0.0.0