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,
I am just checking if you got this worked out or you still require any assistance or clarification on the matter.
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.