You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hello, there
I met a problem in a Select method for a combobox: after try to select value that have already selected, combo box remains in expanded state.
Hello, there
I met a problem in a Select method for a combobox: after try to select value that have already selected, combo box remains in expanded state.
This is help me:
public static void SelectItemAndClose(this ComboBox target, string itemText)
{
target.Select(itemText);
CollapseComboBox(target);
}
public static void SelectItemAndClose(this ComboBox target, int index)
{
target.Select(index);
CollapseComboBox(target);
}
private static void CollapseComboBox(ComboBox target)
{
var ecp = target.AutomationElement.GetPattern(ExpandCollapsePattern.Pattern);
if (ecp != null && ecp.Current.ExpandCollapseState == ExpandCollapseState.Expanded)
{
ecp.Collapse();
}
}
Thanks.
The text was updated successfully, but these errors were encountered: