private void AddChildrenRecursive(BoneTreeElement element, TreeViewItem item) { foreach (var childElement in element.Children) { var childItem = CreateTreeViewItem(childElement); item.AddChild(childItem); AddChildrenRecursive(childElement, childItem); } }
private BoneTreeElement BoneInfoToBoneTreeView(BoneInfo bone, ref int id) { var element = new BoneTreeElement { Id = ++id, Name = bone.boneTrans.name, Bone = bone }; if (bone.childs != null && bone.childs.Count() > 0) { foreach (var child in bone.childs) { var childElement = BoneInfoToBoneTreeView(child, ref id); element.AddChild(childElement); } } return(element); }
private BoneTreeView CreateBoneTreeView(List <BoneInfo> rootBoneInfos, TreeViewState treeViewState) { var treeView = new BoneTreeView(treeViewState); var currentId = 0; var root = new BoneTreeElement { Id = ++currentId, Name = "Bones" }; for (int i = 0; i < rootBoneInfos.Count(); i++) { root.AddChild(BoneInfoToBoneTreeView(rootBoneInfos[i], ref currentId)); } treeView.Setup(new List <BoneTreeElement> { root }.ToArray()); return(treeView); }
private TreeViewItem CreateTreeViewItem(BoneTreeElement model) { return(new BoneTreeElement { id = model.Id, displayName = model.Name, Bone = model.Bone }); }
public void AddChild(BoneTreeElement child) { Children.Add(child); }