public TextPatternRange RangeFromChild(AutomationElement childElement, bool log) { if (log) { procedureLogger.Action(string.Format("Get the range from child of {0}.", this.NameAndType)); } TextPattern tp = (TextPattern)element.GetCurrentPattern(TextPattern.Pattern); return((TextPatternRange)tp.RangeFromChild(childElement)); }
/// <summary> /// Retrieves a text range enclosing a child element such as an image, hyperlink, Microsoft Excel spreadsheet, or other embedded object /// </summary> /// <param name="control">The enclosed object</param> /// <returns> /// A range that spans the child element /// </returns> internal static TextPatternRange GetRangeFromChild(AutomationElement control) { TextPattern pat = (TextPattern)CommonUIAPatternHelpers.CheckPatternSupport(TextPattern.Pattern, control); return(pat.RangeFromChild(control)); }