Event arguments accompanying a 'TreeNode' operation.
Наследование: System.EventArgs
Пример #1
0
 private void FireRemovingChild(TreeNodeEventArgs e) { if (RemovingChild != null) RemovingChild(this, e); }
Пример #2
0
 private void FireChildRemoved(TreeNodeEventArgs e) { if (RemovedChild != null) RemovedChild(this, e); FireChildrenChanged(); }
Пример #3
0
 private void FireChildAdded(TreeNodeEventArgs e) { if (AddedChild != null) AddedChild(this, e); FireChildrenChanged(); }
Пример #4
0
 private void FireAddingChild(TreeNodeEventArgs e) { if (AddingChild != null) AddingChild(this, e); }
Пример #5
0
        public void RemoveChild(ITreeNode node)
        {
            // Ignore if the node has already been added.
            if (!Contains(node)) return;

            // Fire pre-event.
            TreeNodeEventArgs args = new TreeNodeEventArgs(node, NullIndex);
            FireRemovingChild(args);

            // Remove the child.
            ChildList.Remove(node);

            // Unwire events.
            node.SelectionChanged -= OnChildSelectionChanged;

            // De-register this as the nodes parent.
            if (node.Parent == this) SetParent(node, null);

            // Fire post-event.
            FireChildRemoved(args);
        }
Пример #6
0
        public void InsertChild(int index, ITreeNode node)
        {
            // Setup initial conditions.
            if (node == null) return;
            if (Contains(node)) return; // Ignore if the node has already been added.
            if (index < 0) index = ChildCount;

            // Fire pre-event.
            TreeNodeEventArgs args = new TreeNodeEventArgs(node, index);
            FireAddingChild(args);

            // Store the node.
            ChildList.Insert(index, node);

            // Wire up events.
            node.SelectionChanged += OnChildSelectionChanged;

            // Ensure the parent node is set to this.
            if (node.Parent != this) SetParent(node, this);

            // Fire post-event.
            FireChildAdded(args);
        }