Exemplo n.º 1
0
        void OnSelectedItemChanging(TreeNodeChangingRoutedEventArgs routedEventArgs)
        {
            RaiseEvent(routedEventArgs);
            ExtTreeNode node = routedEventArgs.ChangedNode as ExtTreeNode;

            if (node != null)
            {
                node.ContextMenu = MenuService.CreateContextMenu(node, node.ContextmenuAddinTreePath);
            }
        }
Exemplo n.º 2
0
        public int CompareTo(object obj)
        {
            ExtTreeNode extTreeNode = obj as ExtTreeNode;

            if (extTreeNode == null)
            {
                TreeNode treeNode = obj as TreeNode;
                return(string.Compare(this.CompareString, treeNode.Header.ToString(), StringComparison.CurrentCulture));
            }
            return(string.Compare(this.CompareString, extTreeNode.CompareString, StringComparison.CurrentCulture));
        }
Exemplo n.º 3
0
        protected override void OnMouseDoubleClick(MouseButtonEventArgs e)
        {
            base.OnMouseDoubleClick(e);
            ExtTreeNode node = e.Source as ExtTreeNode;

            if (node != null)
            {
                node.ActivateItem();
                node.SetEditMode();
            }
        }
Exemplo n.º 4
0
        void DeleteNode(ExtTreeNode node)
        {
            if (node == null)
            {
                return;
            }

            if (node.EnableDelete)
            {
                node.Visibility = Visibility.Visible;
                node.IsSelected = true;
                node.Delete();
            }
        }
Exemplo n.º 5
0
        protected override void OnKeyDown(System.Windows.Input.KeyEventArgs e)
        {
            base.OnKeyDown(e);
            if (e.Key == Key.Enter)
            {
                ExtTreeNode node = SelectedItem as ExtTreeNode;
                if (node != null)
                {
                    node.ActivateItem();
                }
            }

            if (e.Key == Key.F2)
            {
                ExtTreeNode node = SelectedItem as ExtTreeNode;
                if (node != null)
                {
                    node.SetEditMode();
                }
            }
        }
Exemplo n.º 6
0
        public virtual void UpdateVisibility()
        {
            for (int i = 0; i < invisibleNodes.Count;)
            {
                if (invisibleNodes[i].Visible)
                {
                    invisibleNodes[i].AddTo(this);
                    invisibleNodes.RemoveAt(i);
                    continue;
                }
                ++i;
            }

            foreach (TreeNode node in Items)
            {
                if (node is ExtTreeNode)
                {
                    ExtTreeNode extTreeNode = (ExtTreeNode)node;
                    if (!extTreeNode.Visible)
                    {
                        invisibleNodes.Add(extTreeNode);
                    }
                }
            }

            foreach (TreeNode node in invisibleNodes)
            {
                Items.Remove(node);
            }

            foreach (TreeNode node in Items)
            {
                if (node is ExtTreeNode)
                {
                    ((ExtTreeNode)node).UpdateVisibility();
                }
            }
        }