public override bool MoveToPreviousFlatNode() { if (this.node == null) { return(false); } TreeGridNode nextNode = this.node; if (this.node.childIndex == 0) { // We're at the top of this list of children. Pop up to the parent if we have one. if (this.node.Parent is RootTreeGridNode) { return(false); } nextNode = this.node.Parent; } else { nextNode = this.node.Parent.GetOrCreateChildNode(this.node.childIndex - 1); nextNode = FindLastNode(nextNode); } nextNode.AddExternalReference(); this.node.ReleaseExternalReference(); this.node = nextNode; return(true); }
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); }
public override bool MoveToFirstCollapsePoint() { if (this.node == null) { return(false); } TreeGridNode collapsePoint = FindFirstCollapsePoint(this.node); if (collapsePoint == this.node || collapsePoint == null) { // Didn't move return(false); } collapsePoint.AddExternalReference(); this.node.ReleaseExternalReference(); this.node = collapsePoint; return(true); }
public override bool MoveToParentNode() { if (this.node == null) { return(false); } TreeGridNode parentNode = this.node.Parent; // Can't move up to root node... if (parentNode is ChildTreeGridNode) { parentNode.AddExternalReference(); this.node.ReleaseExternalReference(); this.node = parentNode; return(true); } return(false); }