Exemple #1
0
 /// <summary>
 /// Raises the <see cref="BeforeExpand"/> event.
 /// </summary>
 /// <param name="e">A <see cref="NodeViewCancelEventArgs"/> that contains the event data.</param>
 protected virtual void OnBeforeExpand(NodeViewCancelEventArgs e)
 {
     if (BeforeExpand != null)
     {
         BeforeExpand(this, e);
     }
 }
Exemple #2
0
 /// <summary>
 /// Raises the <see cref="BeforeSelect"/> event.
 /// </summary>
 /// <param name="e">A <see cref="NodeViewCancelEventArgs"/> that contains the event data.</param>
 protected virtual void OnBeforeSelect(NodeViewCancelEventArgs e)
 {
     if (BeforeSelect != null)
     {
         BeforeSelect(this, e);
     }
 }
Exemple #3
0
        /// <summary>
        /// Forwards the <see cref="BeforeExpand"/> event.
        /// </summary>
        /// <param name="e">A <see cref="TreeViewCancelEventArgs"/> that contains the event data.</param>
        protected sealed override void OnBeforeExpand(TreeViewCancelEventArgs e)
        {
            NodeViewCancelEventArgs newArgs = new NodeViewCancelEventArgs((Node)e.Node, e.Cancel,
                                                                          (NodeViewAction)e.Action);

            OnBeforeExpand(newArgs);
            e.Cancel = newArgs.Cancel;

            base.OnBeforeExpand(e);

            // Update the image keys and show the children if the node should get expanded.
            if (!e.Cancel)
            {
                newArgs.Node.UpdateImageKeys();
                newArgs.Node.Nodes.Clear();
                // Since the node count might have changed meanwhile, check if there are still children available.
                List <Node> children = newArgs.Node.GetNodes();
                if (children != null)
                {
                    foreach (Node childNode in children)
                    {
                        newArgs.Node.Nodes.Add(childNode);
                    }
                }
            }
        }
Exemple #4
0
 /// <summary>
 /// Raises the <see cref="BeforeCollapse"/> event.
 /// </summary>
 /// <param name="e">A <see cref="NodeViewCancelEventArgs"/> that contains the event data.</param>
 protected virtual void OnBeforeCollapse(NodeViewCancelEventArgs e)
 {
     if (BeforeCollapse != null)
     {
         BeforeCollapse(this, e);
     }
 }
Exemple #5
0
 /// <summary>
 /// Raises the <see cref="BeforeCheck"/> event.
 /// </summary>
 /// <param name="e">A <see cref="NodeViewCancelEventArgs"/> that contains the event data.</param>
 protected virtual void OnBeforeCheck(NodeViewCancelEventArgs e)
 {
     if (BeforeCheck != null)
     {
         BeforeCheck(this, e);
     }
 }
Exemple #6
0
        /// <summary>
        /// Forwards the <see cref="BeforeSelect"/> event.
        /// </summary>
        /// <param name="e">A <see cref="TreeViewCancelEventArgs"/> that contains the event data.</param>
        protected sealed override void OnBeforeSelect(TreeViewCancelEventArgs e)
        {
            NodeViewCancelEventArgs newArgs = new NodeViewCancelEventArgs((Node)e.Node, e.Cancel,
                                                                          (NodeViewAction)e.Action);

            OnBeforeSelect(newArgs);
            e.Cancel = newArgs.Cancel;

            base.OnBeforeSelect(e);
        }
Exemple #7
0
        /// <summary>
        /// Forwards the <see cref="BeforeCollapse"/> event.
        /// </summary>
        /// <param name="e">A <see cref="TreeViewCancelEventArgs"/> that contains the event data.</param>
        protected sealed override void OnBeforeCollapse(TreeViewCancelEventArgs e)
        {
            NodeViewCancelEventArgs newArgs = new NodeViewCancelEventArgs((Node)e.Node, e.Cancel,
                                                                          (NodeViewAction)e.Action);

            OnBeforeCollapse(newArgs);
            e.Cancel = newArgs.Cancel;

            base.OnBeforeCollapse(e);

            // Update the image keys and remove the children if the node should get collapsed.
            if (!e.Cancel)
            {
                newArgs.Node.UpdateImageKeys();
                newArgs.Node.Nodes.Clear();
                if (newArgs.Node.GetNodeCount() > 0)
                {
                    newArgs.Node.Nodes.Add(new Node(this));
                }
            }
        }