ScrollItemPattern( AutomationElement element, IUIAutomationScrollItemPattern scrollItemPattern) : base(el: element) { this._scrollItemPattern = scrollItemPattern; }
protected override void Dispose(bool disposing) { if (Pattern != null) { System.Runtime.InteropServices.Marshal.ReleaseComObject(Pattern); this.Pattern = null; } base.Dispose(disposing); }
/// <summary> /// <para>Sets/Resets the Pattern and its properties.</para> /// <para>Useful in this class for resetting the Pattern's properties after an action is performed on the Element.</para> /// </summary> private void Initialize(Element element) { this._element = element; int counter = 0; do { try { _ScrollItemPattern = (IUIAutomationScrollItemPattern)_element.IUIElement.GetCurrentPattern(UIA_PatternIds.UIA_ScrollItemPatternId); } catch (COMException e) { } } while (_ScrollItemPattern == null && counter++ < 10); if (_ScrollItemPattern == null) { throw new Exception($"Pattern is not available for Element where Name=[{_element.Name}] - AutomationId=[{_element.AutomationId}] - ClassName=[{_element.ClassName}]."); } }
public ScrollItemPattern(A11yElement e, IUIAutomationScrollItemPattern p) : base(e, PatternType.UIA_ScrollItemPatternId) { Pattern = p; }
public static void xtScrollIntoView(this IUIAutomationElement element) { _ScrollItemPattern = (IUIAutomationScrollItemPattern)element.GetCurrentPattern(UIA_PatternIds.UIA_ScrollItemPatternId); _ScrollItemPattern.ScrollIntoView(); }
private ScrollItemPattern(AutomationElement el, IUIAutomationScrollItemPattern pattern, bool cached) : base(el, cached) { Debug.Assert(pattern != null); this._pattern = pattern; }
internal static ScrollItemPattern Wrap( AutomationElement element, IUIAutomationScrollItemPattern scrollItemPattern) { return(new ScrollItemPattern(element: element, scrollItemPattern: scrollItemPattern)); }