Beispiel #1
0
        public void SelectNodeAndRectangle(Tree node)
        {
            TreeViewItem item = GetCorrespondingItem(node);

            if (item != null)
            {
                item.IsSelected = true;
                //item.IsExpanded = true;
                item.IsEnabled = true;

                item.BringIntoView();

                IEnumerable <ViewableTreeNode> allitems = GetAllItems();
                foreach (ViewableTreeNode vtn in allitems)
                {
                    if (vtn.IsLocked)
                    {
                        vtn.IsSelected = false;
                    }
                }

                ViewableTreeNode viewablenode = item.DataContext as ViewableTreeNode;
                viewablenode.IsSelected = true;
            }
        }
Beispiel #2
0
 private void GetAllItemsHelper(List <ViewableTreeNode> items, ViewableTreeNode viewableTreeNode)
 {
     items.Add(viewableTreeNode);
     foreach (ViewableTreeNode child in viewableTreeNode.Children)
     {
         GetAllItemsHelper(items, child);
     }
 }
Beispiel #3
0
 public TreeViewItem GetCorrespondingItem(Tree node)
 {
     if (TreeNodes.Count == 1)
     {
         ViewableTreeNode viewablenode = GetCorrespondingViewableNode(node, TreeNodes[0]);
         if (viewablenode != null)
         {
             return(GetTreeViewItem(TreeViewControl, viewablenode));
         }
     }
     return(null);
 }
Beispiel #4
0
        public void SelectNode(Tree node)
        {
            TreeViewItem item = GetCorrespondingItem(node);

            if (item != null)
            {
                item.IsSelected = true;
                //item.IsExpanded = true;
                item.IsEnabled = true;

                item.BringIntoView();


                ViewableTreeNode viewablenode = item.DataContext as ViewableTreeNode;
            }
        }
Beispiel #5
0
        private void ItemText_Mouseup(object sender, MouseButtonEventArgs e)
        {
            if (_mouseUp != null)
            {
                TextBlock        tb                     = sender as TextBlock;
                ViewableTreeNode viewablenode           = tb.DataContext as ViewableTreeNode;
                IEnumerable <ViewableTreeNode> allitems = GetAllItems();
                foreach (ViewableTreeNode item in allitems)
                {
                    item.IsSelected = false;
                }

                viewablenode.IsSelected = true;

                _mouseUp(viewablenode, e);
            }
        }
Beispiel #6
0
        private ViewableTreeNode GetCorrespondingViewableNode(Tree node, ViewableTreeNode currNode)
        {
            if (currNode.Node == node)
            {
                return(currNode);
            }

            foreach (ViewableTreeNode child in currNode.Children)
            {
                ViewableTreeNode corresponding = GetCorrespondingViewableNode(node, child);
                if (corresponding != null)
                {
                    return(corresponding);
                }
            }


            return(null);
        }
Beispiel #7
0
 private void AddTreeBrowserNodes(Tree tree)
 {
     ViewableTreeNode root = new ViewableTreeNode(tree);
     TreeBrowserControl.TreeNodes.Clear();
     TreeBrowserControl.TreeNodes.Add(root);
     
 }