public override void Invoke() { switch (_expandCollapsePattern.CurrentExpandCollapseState) { case ExpandCollapseState.ExpandCollapseState_Collapsed: _expandCollapsePattern.Expand(); break; case ExpandCollapseState.ExpandCollapseState_Expanded: case ExpandCollapseState.ExpandCollapseState_PartiallyExpanded: _expandCollapsePattern.Collapse(); break; } }
/// <summary> /// Collapses the element. /// </summary> public void Collapse() { _pattern.Collapse(); }
public static IUIAutomationElement xtCollapse(this IUIAutomationElement element) { _ExpandCollapsePattern = (IUIAutomationExpandCollapsePattern)element.GetCurrentPattern(UIA_PatternIds.UIA_ExpandCollapsePatternId); _ExpandCollapsePattern.Collapse(); return(element); }