What is up with the TreeView ?

G

Guest

Is there really no way of binding the treeview to a datasource like an XML
Document?

Surely, given that XML is hierarchical and the Tree View control is
hierarchical I would expect Microsoft to have extended it for us, instead of
us having to loop through a huge XML document adding nodes one by one?

Is Microsoft doing something about this - in VB6 it was better!

Or do we have to build our own treeview from scratch in order to shadow an
XML Document?

Our problem is we are displaying the nodes of a huge XML document that the
user can edit, and it takes far too long to reload the treeview.

thx for any help or advice
 
N

Nick Hounsome

Philip said:
Is there really no way of binding the treeview to a datasource like an XML
Document?

Surely, given that XML is hierarchical and the Tree View control is
hierarchical I would expect Microsoft to have extended it for us, instead
of
us having to loop through a huge XML document adding nodes one by one?

But what would this binding show?

How would it know what the child nodes were?

Tree's are inherently more complicated than lists and it is hard to see what
sort of binding model could work in general.
Is Microsoft doing something about this - in VB6 it was better!

Or do we have to build our own treeview from scratch in order to shadow an
XML Document?

There are numerous ways to represent an XmlDocument in a tree.
The most obvious question is "how do you represent attributes?"
Our problem is we are displaying the nodes of a huge XML document that the
user can edit, and it takes far too long to reload the treeview.

How could it be any quicker if it used databinding?
There are lots of ways to gain and lose performance with tree views.
Are you using BeginUpdate() and EndUpdate()?
 
G

Grant Frisken

If you are open to a commercial solution you could take a look at
Infralutions Virtual Tree. It does provide a general purpose data
binding model that works very well. Data binding does provide the
possiblity of real performance improvements because only those nodes
that actually need to be displayed for the current tree state need to
be loaded. This means you can display a tree containing millions of
items extremely quickly because you only have to load 30-40 items.
From memory there are some issues binding to XmlDocument and XmlNode
due to the fact that Virtual Tree requires the collection to support
the standard IList interface which XmlNode (being a wrapper for a COM
object) does not. This can however be overcome by using Virtual
Tree's programmatic binding interface and providing an adaptor class.

If you are interested you can get more information and download an
evaluation version from:

www.infralution.com/virtualtree.html

Regards
Grant Frisken
Infralution
 

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