private bool GetItemPath(TreeItem root, ref Stack<TreeItem> stack) { stack.Push(root); if (this.Equals(root)) return true; else foreach (TreeItem c in root.GetChildren()) if (GetItemPath(c, ref stack)) return true; stack.Pop(); return false; }
public HolderTreeItem(TreeItem hold) { m_Hold = hold; }
public List<TreeItem> GetPath(TreeItem root, bool leaveOutRootInReturnValue) { Stack<TreeItem> stack = new Stack<TreeItem>(); this.GetItemPath(root, ref stack); return leaveOutRootInReturnValue ? stack.Take(stack.Count - 1).Reverse().ToList() : stack.Reverse().ToList(); }