public static TreeStatus Save(TreeViewItem treeViewItem) { if (treeViewItem == null) return null; TreeStatus status = new TreeStatus(treeViewItem); SaveStatus(treeViewItem, status); return status; }
public static TreeStatus Save(TreeViewItem treeViewItem) { if (treeViewItem == null) { return(null); } TreeStatus status = new TreeStatus(treeViewItem); SaveStatus(treeViewItem, status); return(status); }
public static void Restore(TreeViewItem treeViewItem, TreeStatus treeStatus) { treeViewItem.IsExpanded = treeStatus.IsExpanded; for (int x = 0; x < treeStatus.StatusList.Length; x++) { TreeViewItem t = treeViewItem.Items[x] as TreeViewItem; if (t != null) { t.IsExpanded = treeStatus.StatusList[x].IsExpanded; Restore(t, treeStatus.StatusList[x]); } } }
private static void SaveStatus(TreeViewItem treeViewItem, TreeStatus treeStatus) { treeStatus.IsExpanded = treeViewItem.IsExpanded; for (int x = 0; x < treeViewItem.Items.Count; x++) { TreeViewItem t = treeViewItem.Items[x] as TreeViewItem; if (t != null) { TreeStatus ts = new TreeStatus(t); treeStatus.StatusList[x] = ts; SaveStatus(t, ts); } } }