How to sort the nodes in WinForms MultiColumnTreeView?
Sorting
In WinForms Multicolumn TreeView, you can sort selected node and its node collection by using the SortOrder property and Sort function in TreeNodeAdv. Refer to the following code examples.
C#
//Sets the selected tree node Sorting order as ascending this.multiColumnTreeView1.SelectedNode.SortOrder = SortOrder.Ascending; //Sets the selected tree node Sorting order as descending this.multiColumnTreeView1.SelectedNode.SortOrder = SortOrder.Descending; //Sets the selected tree node Sorting order as None this.multiColumnTreeView1.SelectedNode.SortOrder = SortOrder.None; //Sorts the selected tree nodes with specified sort order this.multiColumnTreeView1.SelectedNode.Sort();
VB
'Sets the selected tree node Sorting order as ascending Me.multiColumnTreeView1.SelectedNode.SortOrder = SortOrder.Ascending 'Sets the selected tree node Sorting order as descending Me.multiColumnTreeView1.SelectedNode.SortOrder = SortOrder.Descending 'Sets the selected tree node Sorting order as None Me.multiColumnTreeView1.SelectedNode.SortOrder = SortOrder.None 'Sorts the selected tree nodes with specified sort order Me.multiColumnTreeView1.SelectedNode.Sort
If TreenodeAdv column is sorted, corresponding subitem column will also updated.
Figure 1: Ascending order of the selected nodes in MultiColumnTreeView
Figure 2: Descending order of the selected nodes in MultiColumnTreeView.
Samples:
C#: https://www.syncfusion.com/downloads/support/directtrac/139533/MultiColumnTreeview_Sort457457753.zip
Reference link: https://help.syncfusion.com/windowsforms/multicolumn-treeview/sorting
Conclusion
I hope you enjoyed learning about how to sort the nodes in WinForms Multicolumn TreeView.
You can refer to our WinForms Multicolumn TreeView’s feature tour page to know about its other groundbreaking feature representations. You can also explore our WinForms Multicolumn TreeView documentation to understand how to present and manipulate data.
For current customers, you can check out our WinForms components from the License and Downloads page. If you are new to Syncfusion, you can try our 30-day free trial to check out our WinForms Multicolumn TreeView and other WinForms components.
If you have any queries or require clarifications, please let us know in comments below. You can also contact us through our support forums, Direct-Trac, or feedback portal. We are always happy to assist you!