public static TreeNodeGraphics CreateTree(GraphicsElement root, Core.Types.TreeBase tree) { TreeNodeGraphics tg = new TreeNodeGraphics(tree); tg.ParentGraphics = root; if (tree.GetChildrenAsTreeBase().Count() > 0) { foreach (TreeBase child in tree.GetChildrenAsTreeBase()) { if (child != null) tg.Add(CreateTree(tg, child)); } } return tg; }