private XamDataTreeNode LoadTree(XmlNode dataNode, int index) { XamDataTreeNode visualNode = new XamDataTreeNode(index, null, MakeTextBox(dataNode.Name), false, null);
int count = 0; foreach (XmlNode child in dataNode.ChildNodes) { visualNode.Nodes.Add(LoadTree(child, count++)); }
visualNode.IsExpanded = true;
//IEntityCollection collection1 = factory.FetchMulti(filterObject); return visualNode; }
This code causes NullReferenceException because visualNode.Nodes is not initialized. I failed to initialize this myself as this property is read-only.
I have a multi-level tree structure and must load data based on the position in that structure. Also I must analyze the children to define the looks for the current node. The datatree can start anywhere on the predefined structure.
These requirements are so specific that I've given up on using databinding right away.
Hello,
Thank you for your feedback. I am glad that you resolved your issue and I believe that other community members may benefit from this as well.
Thanks again.
I resolved this by mapping the XamDataTree to a class holding an ObservableCollection with instances of his own type. In this class I specify a Label to be used as content.
If possible please remove this question.
I am just checking if you got this worked out or you still require any assistance or clarification on the matter.
Thank you for your post. I have been looking into it, but it seems like that I am missing something in your scenario, so if this is still an issue for you, could you please send an isolated sample project, where the issue is reproduced, so I can investigate it further for you.
Looking forward for your reply.