Hey all,
I'm trying to use databinding on an UltraTree control.
I have the datasource set up, and the data is showing up as expected in the tree. However, the application I'm modifying makes extensive use of the Tag for each node; specifically, the tag contains an object that contains all the pertinent information for each node. Before databinding, that information was set manually, for each node.
My question: Is there a way that I can have the Tag property modified as each node is created via databinding?
Hello and thank you for contacting Infragistics. The tree is very simple and only binds to a collection. My suggestion, if you are looking for a dynamic entry point is to use an event. I suggest using the InitializeDataNode event to update the tag dynamically as this event fires each time a node is added to the tree from the datasource.
Hello Michael,
Thank you for your answer! I'll give this a shot.
Would this also be the place I would use to adjust the font of the node?
Yes you should be able to
To change the appearance of a single node, you need to use the properties of that node.node.Override.NodeAppearance.FontData
Hi Michael,
I'm still having trouble with this. My issue is:
When I am in InitializeDataNode, I'm able to see the node just fine; however, in order to get the data I need for the Tag, I need to look up the value. To do that, I need a value that isn't displayed in the node. The node is displaying a string, and I need the id for that record. I figure the best place for that is in the Key field, but again, I don't know how to set the Key field when the tree is databound. Can you help with this?
Thank you!
Fletch
Use the Cells property to get the property you want. Yes there is a DataKey property too but the Cells collection is a way to access your other fields in your datasource. eg.
UltraTreeNodeCell cell = e.Node.Cells["IDField"];