Beispiel #1
0
 protected virtual void OnNodeExpanded(ExpandedEventArgs e)
 {
     if (NodeExpanded != null)
     {
         NodeExpanded(this, e);
     }
 }
Beispiel #2
0
        internal protected virtual bool ExpandNode(TreeGridNode node)
        {
            if (!node.IsExpanded || _virtualNodes)
            {
                ExpandingEventArgs exp = new ExpandingEventArgs(node);
                OnNodeExpanding(exp);

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

                    //TODO Convert this to a InsertRange
                    foreach (TreeGridNode childNode in node.Nodes)
                    {
                        Debug.Assert(childNode.RowIndex == -1, "Row is already in the grid.");

                        SiteNode(childNode);
                        //BaseRows.Insert(rowIndex + 1, childRow);
                        //TODO : remove -- just a test.
                        //childNode.Cells[0].Value = "child";
                    }

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

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