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
I have a need to get the selection from a disabled WPF .NET 6 ComboBox in order to verify the selection even though it is disabled. I found a way for a WinForms .NET Framework ComboBox, but the solution doesn't work for a .NET 6 WPF ComboBox.
What worked for the WinForms .NET Framework ComboBox was:
` AutomationElement comboElement = window.GetElement(SearchCriteria.ByControlType(ControlType.ComboBox).AndAutomationId(automationId));
if (comboElement != null)
{
LogEntry.Debug(log, $"Found ComboBox AutomationElement");
comboElement.TryGetCurrentPattern(ValuePattern.Pattern, out object oPattern);
if (oPattern != null)
{
text = (oPattern as ValuePattern).Current.Value;
LogEntry.Debug(log, $"Combo Selected Text = \"{text}\"");
}
else
{
LogEntry.Debug(log, "Failed to get ComboBox ValuePattern");
}
}
`
The text was updated successfully, but these errors were encountered:
I have a need to get the selection from a disabled WPF .NET 6 ComboBox in order to verify the selection even though it is disabled. I found a way for a WinForms .NET Framework ComboBox, but the solution doesn't work for a .NET 6 WPF ComboBox.
What worked for the WinForms .NET Framework ComboBox was:
` AutomationElement comboElement = window.GetElement(SearchCriteria.ByControlType(ControlType.ComboBox).AndAutomationId(automationId));
`
The text was updated successfully, but these errors were encountered: