Ejemplo n.º 1
0
		public ExpandedEventArgs(TreeGridNode node):base(node)
		{
		}
Ejemplo n.º 2
0
		public ExpandingEventArgs(TreeGridNode node):base()
		{
			this._node = node;
		}
Ejemplo n.º 3
0
		public CollapsedEventArgs(TreeGridNode node)
			: base(node)
		{
		}
Ejemplo n.º 4
0
		public CollapsingEventArgs(TreeGridNode node)
			: base()
		{
			this._node = node;
		}
Ejemplo n.º 5
0
		public TreeGridNodeEventBase(TreeGridNode node)
		{
			this._node = node;
		}
Ejemplo n.º 6
0
        internal protected virtual void SiteNode(TreeGridNode node)
        {
            //TODO: Raise exception if parent node is not the root or is not sited.
            int          rowIndex = -1;
            TreeGridNode currentRow;

            node._grid = this;

            if (node.Parent != null && node.Parent.IsRoot == false)
            {
                // row is a child
                Debug.Assert(node.Parent != null && node.Parent.IsExpanded == true);

                if (node.Index > 0)
                {
                    currentRow = node.Parent.Nodes[node.Index - 1];
                }
                else
                {
                    currentRow = node.Parent;
                }
            }
            else
            {
                // row is being added to the root
                if (node.Index > 0)
                {
                    currentRow = node.Parent.Nodes[node.Index - 1];
                }
                else
                {
                    currentRow = null;
                }
            }

            if (currentRow != null)
            {
                while (currentRow.Level >= node.Level)
                {
                    if (currentRow.RowIndex < base.Rows.Count - 1)
                    {
                        currentRow = base.Rows[currentRow.RowIndex + 1] as TreeGridNode;
                        Debug.Assert(currentRow != null);
                    }
                    else
                    {
                        // no more rows, site this node at the end.
                        break;
                    }
                }
                if (currentRow == node.Parent)
                {
                    rowIndex = currentRow.RowIndex + 1;
                }
                else if (currentRow.Level < node.Level)
                {
                    rowIndex = currentRow.RowIndex;
                }
                else
                {
                    rowIndex = currentRow.RowIndex + 1;
                }
            }
            else
            {
                rowIndex = 0;
            }


            Debug.Assert(rowIndex != -1);
            this.SiteNode(node, rowIndex);

            Debug.Assert(node.IsSited);
            if (node.IsExpanded)
            {
                // add all child rows to display
                foreach (TreeGridNode childNode in node.Nodes)
                {
                    //TODO: could use the more efficient SiteRow with index.
                    this.SiteNode(childNode);
                }
            }
        }