By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
454,775 Members | 1,345 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 454,775 IT Pros & Developers. It's quick & easy.

Specific IComparer use with TreeNodeCollection

P: n/a
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

May 11 '06 #1
Share this Question
Share on Google+
3 Replies


P: n/a
Have you tried using the TreeViewNodeSorter property on the TreeView
class?

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

<es********@hotmail.com> wrote in message
news:11**********************@q12g2000cwa.googlegr oups.com...
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

May 11 '06 #2

P: n/a
Unfortunately we're not using .NET 2.0 so that property is not
available yet.

May 11 '06 #3

P: n/a
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.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

<es********@hotmail.com> wrote in message
news:11**********************@i39g2000cwa.googlegr oups.com...
Unfortunately we're not using .NET 2.0 so that property is not
available yet.

May 11 '06 #4

This discussion thread is closed

Replies have been disabled for this discussion.