Can somebody point me towards examples for initializing the child/parent relationship for diagram nodes derived from HierarchicalNodeViewModel? This example code from the MVVM serialization example (http://docs.telerik.com/devtools/wpf/controls/raddiagram/howto/raddiagrams-serialize-databound-diagram) results in a Children property with 0 entries for the rootNode:
private void BindGraphSource(){ int uniqueIdCounter = 0; GraphSource source = new GraphSource(); OrgItem rootItem = new OrgItem() { Title = "CEO", Position = new Point(200, 20), Id = (uniqueIdCounter++).ToString() }; source.AddNode(rootItem); OrgItem unitOne = new OrgItem() { Title = "Unit Manager USA", Position = new Point(100, 100), Id = (uniqueIdCounter++).ToString() }; source.AddNode(unitOne); source.AddLink(new OrgLink(rootItem, unitOne) { Id = (uniqueIdCounter++).ToString() }); OrgItem unitTwo = new OrgItem() { Title = "Unit Manager Europe", Position = new Point(300, 100), Id = (uniqueIdCounter++).ToString() }; source.AddNode(unitTwo); source.AddLink(new OrgLink(rootItem, unitTwo) { Id = (uniqueIdCounter++).ToString() }); this.xDiagram.GraphSource = source;}
Manually setting the children doesn't seem straighforward, either: Even though the doc for the HierarchicalNodeViewModel.Children property reads "Gets or sets the children of the current node", the property only has a getter and no setter:
public ObservableCollection<HierarchicalNodeViewModel> Children { get; }