Hello,
I'm setting up an UltraTree bound to a binding source. This binding source is itself bound to an object which contains several generic collections.
What I would like to do is add a root node and customize the label for the nodes corresponding to the collections of my object.
Can anyone help me?
Thanks,
Damien
HI Damien,
You can bind the tree on any particular level you want using the SetDataBinding method on the Nodes collection.
So you could add a root node to the tree, or even several nodes, and then bind the child nodes of that node using something like this:
node.Nodes.SetDataBinding(myDataSource, myDataMember);
Hi Mike,
Thanks for your answer.
After some tests (and if I understand this correctly), I managed to use your solution: I need to add a root node and as many child nodes to this node as I have collections in my object because I can only bind to the collections and not to my object! That means I cannot use my binding source anymore...
Let me concretise this a little bit. I have a Configuration objet with several generic collection properties (InputStructures, Processings and References). What I want to have in my tree view is this:
Configuration - Input structures - Input structure 1 - Input structure 2 - Processings - Processing 1 ...
Since I am trying to use databinding as efficiently as possible, I have set up a BindingSource in my UserControl that I use as the datasource for several controls, including my UltraTree. The DataSource property of this BindingSource is of course an instance of my Configuration class. But maybe I am doing something wrong...
I have added a zip file containing a downsize version of my project. I have added your solution (at least the way I understood it and had it work).
So, is that the only way? Is there a way I can use my BindingSource object?