diff --git a/src/Microsoft.DotNet.Wpf/src/PresentationFramework/System/Windows/Automation/Peers/ComboBoxAutomationPeer.cs b/src/Microsoft.DotNet.Wpf/src/PresentationFramework/System/Windows/Automation/Peers/ComboBoxAutomationPeer.cs index 466d9161621..961dbad8607 100644 --- a/src/Microsoft.DotNet.Wpf/src/PresentationFramework/System/Windows/Automation/Peers/ComboBoxAutomationPeer.cs +++ b/src/Microsoft.DotNet.Wpf/src/PresentationFramework/System/Windows/Automation/Peers/ComboBoxAutomationPeer.cs @@ -37,27 +37,20 @@ protected override string GetClassNameCore() /// public override object GetPattern(PatternInterface pattern) { - object iface = null; ComboBox owner = (ComboBox)Owner; - if (pattern == PatternInterface.Value) + if ((pattern is PatternInterface.Value && owner.IsEditable) || pattern is PatternInterface.ExpandCollapse) { - if (owner.IsEditable) iface = this; + return this; } - else if(pattern == PatternInterface.ExpandCollapse) - { - iface = this; - } - else if (pattern == PatternInterface.Scroll && !owner.IsDropDownOpen) - { - iface = this; - } - else + + if (pattern is PatternInterface.Scroll && !owner.IsDropDownOpen) { - iface = base.GetPattern(pattern); + return null; } - return iface; + // PatternInterface.Scroll is handled by ItemsControlAutomationPeer when Expanded/DropDown is open + return base.GetPattern(pattern); } ///