Getting the "Final" Width of a Treeview


J

John Ruiz

Greetings, Hi, and Hello. Hola, even.

I have a TreeView object in a User Control (.ascx). The nodes in this tree
are programmatically added when the control is first loaded.

When I load the control, the TreeView displays quite nicely and its width is
exactly the width that is required for the displayed tree. As I expand the
nodes on my pretty TreeView, the width increases, making the TreeView - once
again - exactly the width that is required for the displayed tree.

Please, will someone suggest a way to program my pretty TreeView such that
when it loads for the first time, it automatically sets its width to the
maximum needed width of the possible tree? Of course, dynamically adding or
removing nodes could change this width, but knowing the maximum width of the
TreeView at the time it loads is all I need.

Thank you so much for making my pretty TreeView just a little bit prettier!

~John
 
Ad

Advertisements


Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top