Specific IComparer use with TreeNodeCollection

  • Thread starter Thread starter escristian
  • Start date Start date
E

escristian

Hello.
I am trying to use a specific IComparer object to sort the nodes of my
TreeView. Now if it was an Array I could simply call Sort() and pass it
my IComparer object. But with the TreeNodeCollection object there is no
sort method.

Can anyone give me some ideas on how to implement this?
Thanks
 
Have you tried using the TreeViewNodeSorter property on the TreeView
class?

Hope this helps.
 
If that is the case, then you are going to have to implement it
yourself. You will have to insert/remove all of the items in the list in
the order you wish to sort them.

I would recommend performing the sorting before you attach the nodes to
the trees, to cut down on the number of repaints of the control.

Hope this helps.
 
Back
Top