Example #1
0
 protected virtual void OnNodeCollapsing(CollapsingEventArgs e)
 {
     if (this.NodeCollapsing != null)
     {
         NodeCollapsing(this, e);
     }
 }
Example #2
0
        private void Collapse(bool collapseSelf, bool collapseChild)
        {
            CollapsingEventArgs args = new CollapsingEventArgs(this);

            if (collapseSelf)
            {
                this.IsExpanded = false;
                this.Grid.OnNodeCollapsing(args);
            }
            if (!args.Cancel)
            {
                foreach (TreeGridNode node in this.Nodes)
                {
                    node.Collapse(collapseChild, collapseChild);
                    node.Visible = false;
                }
                this.Grid.InvalidateCell(this.Cells[0]);
                this.Grid.OnNodeCollapsed(this);
            }
        }
Example #3
0
        internal protected virtual bool CollapseNode(TreeGridNode node)
        {
            if (node.IsExpanded)
            {
                CollapsingEventArgs exp = new CollapsingEventArgs(node);
                this.OnNodeCollapsing(exp);

                if (!exp.Cancel)
                {
                    this.LockVerticalScrollBarUpdate(true);
                    this.SuspendLayout();
                    _inExpandCollapse = true;
                    node.IsExpanded   = false;

                    foreach (TreeGridNode childNode in node.Nodes)
                    {
                        Debug.Assert(childNode.RowIndex != -1, "Row is NOT in the grid.");
                        this.UnSiteNode(childNode);
                    }

                    CollapsedEventArgs exped = new CollapsedEventArgs(node);
                    this.OnNodeCollapsed(exped);
                    //TODO: Convert this to a specific NodeCell property
                    _inExpandCollapse = false;
                    this.LockVerticalScrollBarUpdate(false);
                    this.ResumeLayout(true);
                    this.InvalidateCell(node.Cells[0]);
                }

                return(!exp.Cancel);
            }
            else
            {
                // row isn't expanded, so we didn't do anything.
                return(false);
            }
        }