Example #1
0
 void ReplaceWith(SharpTreeNode node)
 {
     if (listParent != null)
     {
         if (listParent.left == this)
         {
             listParent.left = node;
         }
         else
         {
             Debug.Assert(listParent.right == this);
             listParent.right = node;
         }
         if (node != null)
         {
             node.listParent = listParent;
         }
         listParent = null;
     }
     else
     {
         // this was a root node
         Debug.Assert(node != null); // cannot delete the only node in the tree
         node.listParent = null;
         if (treeFlattener != null)
         {
             Debug.Assert(node.treeFlattener == null);
             node.treeFlattener      = this.treeFlattener;
             this.treeFlattener      = null;
             node.treeFlattener.root = node;
         }
     }
 }
Example #2
0
 void Reload()
 {
     if (flattener != null)
     {
         flattener.Stop();
     }
     if (Root != null)
     {
         if (!(ShowRoot && ShowRootExpander))
         {
             Root.IsExpanded = true;
         }
         flattener = new TreeFlattener(Root, ShowRoot);
         flattener.CollectionChanged += flattener_CollectionChanged;
         this.ItemsSource             = flattener;
     }
 }