コード例 #1
0
            public override bool MoveToNextFlatNode()
            {
                if (this.node == null)
                {
                    return(false);
                }

                TreeGridNode nextNode = this.node;

                if (nextNode.IsExpanded && nextNode.items.Count > 0)
                {
                    // We're on a node that is expanded.  Move to its first child.
                    nextNode = nextNode.GetOrCreateChildNode(0);
                }
                else
                {
                    while (nextNode.Parent == null || nextNode.childIndex == nextNode.Parent.items.Count - 1)
                    {
                        // Reached the end of this node.  Pop up a level.  If we're already at the top, we're done.
                        if (nextNode.Parent == null)
                        {
                            return(false);
                        }

                        nextNode = nextNode.Parent;
                    }

                    nextNode = nextNode.Parent.GetOrCreateChildNode(nextNode.childIndex + 1);
                }

                nextNode.AddExternalReference();
                this.node.ReleaseExternalReference();
                this.node = nextNode;
                return(true);
            }
コード例 #2
0
            static TreeGridNode FindLastNode(TreeGridNode node)
            {
                if (node.IsExpanded && node.items != null && node.items.Count > 0)
                {
                    var lastChild = node.GetOrCreateChildNode(node.items.Count - 1);
                    return(FindLastNode(lastChild));
                }

                return(node);
            }
コード例 #3
0
            static TreeGridNode FindLastNode(TreeGridNode node)
            {
                if (node.IsExpanded && node.items != null && node.items.Count > 0)
                {
                    var lastChild = node.GetOrCreateChildNode(node.items.Count - 1);
                    return FindLastNode(lastChild);
                }

                return node;
            }