/// <summary> /// Searches for a previous block "deep" /// (includes children of previous blocks recursively) /// </summary> /// <returns>Focusable block if found; otherwise null</returns> public Block FindPrevFocusableBlockInChain() { Block current = this.Prev; while (current != null) { Block foundFocusableBlock = current.FindLastFocusableBlock(); if (foundFocusableBlock != null && foundFocusableBlock.CanGetFocus) { return(foundFocusableBlock); } current = current.Prev; } if (this.Parent != null) { if (this.Parent.CanGetFocus) { return(this.Parent); } else { return(this.Parent.FindPrevFocusableBlockInChain()); } } return(null); }
/// <summary> /// Searches a "brother" block upwards of startFrom, /// that is above startFrom and is focusable. /// If no such block is found, returns null. /// </summary> /// <param name="startFrom">Block, above which to search (upwards)</param> /// <returns>Focusable sibling block, if found; otherwise null.</returns> //public Block FindPrevFocusableSibling() //{ // Block current = this.Prev; // while (current != null && !current.CanGetFocus) // { // current = current.Prev; // } // return current; //} /// <summary> /// Searches a "brother" block downwards of startFrom, /// that is below startFrom and is focusable. /// If no such block is found, returns null. /// </summary> /// <param name="startFrom">Block, down from which to search (downwards)</param> /// <returns>Focusable sibling block, if found; otherwise null.</returns> //public Block FindNextFocusableSibling() //{ // Block current = this.Next; // while (current != null && !current.CanGetFocus) // { // current = current.Next; // } // return current; //} /// <summary> /// Searches for a previous block "deep" /// (includes children of previous blocks recursively) /// </summary> /// <returns>Focusable block if found; otherwise null</returns> public Block FindPrevFocusableBlock() { Block current = this.Prev; while (current != null) { Block foundFocusableBlock = current.FindLastFocusableBlock(); if (foundFocusableBlock != null) { return(foundFocusableBlock); } current = current.Prev; } return(null); }