Beispiel #1
0
        //------------------------------------------------------------------------------------
        /// <summary>
        /// Worker method for BuildProductTree.
        /// </summary>
        //------------------------------------------------------------------------------------
        private void BuildProductTreeWorker(List <ProductTreeNode> nodes, Node psNode)
        {
            ProductTreeNode node = new ProductTreeNode(psNode);

            nodes.Add(node);

            foreach (Node childNode in psNode.Nodes)
            {
                BuildProductTreeWorker(node.ChildNodes, childNode);
            }
        }
Beispiel #2
0
        //------------------------------------------------------------------------------------
        /// <summary>
        /// Internal worker for PopulateTree.
        /// </summary>
        //------------------------------------------------------------------------------------
        void PopulateUITree(ItemCollection items, ProductTreeNode node)
        {
            TreeViewItem newItem = new TreeViewItem();

            newItem.Header = node;
            items.Add(newItem);

            foreach (ProductTreeNode childNode in node.ChildNodes)
            {
                PopulateUITree(newItem.Items, childNode);
            }
        }
Beispiel #3
0
        //------------------------------------------------------------------------------------
        /// <summary>
        /// Private helper function for SelectFeatureAreaTreeNode.
        /// </summary>
        //------------------------------------------------------------------------------------
        private TreeViewItem SelectTreeViewItem(System.Windows.Controls.TreeView treeView, TreeViewItem item, int treeId)
        {
            ProductTreeNode treeNode = GetTreeNodeFromTreeViewItem(item);

            if (treeNode.TreeID == treeId)
            {
                ExpandTreeViewItem(item);
                item.Focus();
                item.BringIntoView();
                item.IsSelected = true;
                return(item);
            }

            foreach (TreeViewItem childItem in item.Items)
            {
                TreeViewItem selectedItem = SelectTreeViewItem(treeView, childItem, treeId);
                if (selectedItem != null)
                {
                    return(selectedItem);
                }
            }

            return(null);
        }
Beispiel #4
0
        public int GetSelectedAreaTreeID(TreeView treeView)
        {
            ProductTreeNode selectedNode = GetTreeNodeFromTreeViewItem(treeView.SelectedItem as TreeViewItem);

            return(selectedNode == null ? -1 : selectedNode.TreeID);
        }