Hi, My problem walks around binding a Objectcollection to the nodesCollection of a node. I have few static nodes and these static nodes shud be populated with child nodes(Objectcollection,exposed as property from other object ). I dont want to loop thru the ObjectCollection for each object and then create and add the node. I tried Node.Nodes.SetDataBinding(ObjectCollection, "NamedPropertyInObjectsOfTheCollection"). But it always throws NullReferenceException.
Can anyone help me out?
Thanks
Where is the NullReferenceException occurring?
What does the call stack look like?
What is "NamedPropertyInObjectsOfTheCollection"? If you are using a collection as the data source, why are you passing in a DataMember?
hi
I am sorry, i cud solve the null reference problem(it was my mistake in somewhere) and i can see all the objects in the nodes collection now thru setDataBinding. But, the node now shows all the table columns which i dont want to show. I just want to have the text property of the node be set to one of the objects property(the object in here is drived from the table and each property exposed of the object represents a respective column in the table).
How would be the syntax to tell which property of the object would be taken as the textProperty of the node?
And i still have the actual object referencing from the node.ListObject property (to the nodes to which i binded the object collection).
If you don't want teh nodes to show columns, you can set the ViewStyle of the control to Standard. To determine which field of the data is displayed by the node, youuse the NodeTextColumn property of the ColumnSet. You are probably just letting the tree automatically generate the ColumnSets for you, so a good place to do this might be in the ColumnSetGenerated event.