Ejemplo n.º 1
0
 protected virtual void OnNodeCollapsed(CollapsedEventArgs e)
 {
     if (this.NodeCollapsed != null)
     {
         NodeCollapsed(this, e);
     }
 }
Ejemplo n.º 2
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;

                    List <TreeGridNode> nodescollapse = new List <TreeGridNode>();
                    foreach (TreeGridNode nnode in node.Nodes)
                    {
                        nodescollapse.Add(nnode);
                    }
                    foreach (TreeGridNode childNode in nodescollapse)
                    {
                        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);
            }
        }