From 31a4f25818a281618f6fa92a13ccea53000b66d7 Mon Sep 17 00:00:00 2001 From: Arpit Dev Mathur Date: Mon, 8 Jul 2019 18:55:08 -0700 Subject: [PATCH 1/3] Ensuring GroupItemAutomationPeer adds underlying ExpanderPeer to its list of children peers --- .../Peers/GroupItemAutomationPeer.cs | 25 +++++++++++++------ 1 file changed, 17 insertions(+), 8 deletions(-) diff --git a/src/Microsoft.DotNet.Wpf/src/PresentationFramework/System/Windows/Automation/Peers/GroupItemAutomationPeer.cs b/src/Microsoft.DotNet.Wpf/src/PresentationFramework/System/Windows/Automation/Peers/GroupItemAutomationPeer.cs index 6d551508d15..a3c38c4e167 100644 --- a/src/Microsoft.DotNet.Wpf/src/PresentationFramework/System/Windows/Automation/Peers/GroupItemAutomationPeer.cs +++ b/src/Microsoft.DotNet.Wpf/src/PresentationFramework/System/Windows/Automation/Peers/GroupItemAutomationPeer.cs @@ -130,14 +130,7 @@ protected override List GetChildrenCore() ItemsControlAutomationPeer itemsControlAP = itemsControl.CreateAutomationPeer() as ItemsControlAutomationPeer; if (itemsControlAP != null) { - Panel itemsHost = owner.ItemsHost; - - if (itemsHost == null) - return null; - - IList childItems = itemsHost.Children; - List children = new List(childItems.Count); - ItemPeersStorage addedChildren = new ItemPeersStorage(); + List children = new List(); bool useNetFx472CompatibleAccessibilityFeatures = AccessibilitySwitches.UseNetFx472CompatibleAccessibilityFeatures; if (!useNetFx472CompatibleAccessibilityFeatures && owner.Expander != null) @@ -152,6 +145,22 @@ protected override List GetChildrenCore() _expanderPeer.GetChildren(); } } + Panel itemsHost = owner.ItemsHost; + + if (itemsHost == null) + { + if (_expanderPeer == null) + return null; + else + { + children.Add(_expanderPeer); + return children; + } + } + + IList childItems = itemsHost.Children; + ItemPeersStorage addedChildren = new ItemPeersStorage(); + foreach (UIElement child in childItems) { From 18a5cf3a2bad1444196cbf96959880ab1940bab3 Mon Sep 17 00:00:00 2001 From: Arpit Dev Mathur Date: Mon, 15 Jul 2019 18:27:34 -0700 Subject: [PATCH 2/3] Enabling ScrollPattern only when Combobox dropDown is opened --- .../Windows/Automation/Peers/ComboBoxAutomationPeer.cs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) 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 8476bfb2e6f..a1f7341f4a3 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 @@ -51,16 +51,20 @@ override protected string GetClassNameCore() override public object GetPattern(PatternInterface pattern) { object iface = null; + ComboBox owner = (ComboBox)Owner; if (pattern == PatternInterface.Value) { - ComboBox owner = (ComboBox)Owner; if (owner.IsEditable) iface = this; } else if(pattern == PatternInterface.ExpandCollapse) { iface = this; } + else if (pattern == PatternInterface.Scroll) + { + if (owner.IsDropDownOpen) iface = this; + } else { iface = base.GetPattern(pattern); From c14f7d4428c2b092a83c0ba45dfe38d0deccdaff Mon Sep 17 00:00:00 2001 From: Arpit Dev Mathur Date: Mon, 22 Jul 2019 17:37:36 -0700 Subject: [PATCH 3/3] Addressing PR feedback --- .../System/Windows/Automation/Peers/ComboBoxAutomationPeer.cs | 4 ++-- .../Windows/Automation/Peers/GroupItemAutomationPeer.cs | 2 ++ 2 files changed, 4 insertions(+), 2 deletions(-) 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 a1f7341f4a3..7b426dca759 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 @@ -61,9 +61,9 @@ override public object GetPattern(PatternInterface pattern) { iface = this; } - else if (pattern == PatternInterface.Scroll) + else if (pattern == PatternInterface.Scroll && !owner.IsDropDownOpen) { - if (owner.IsDropDownOpen) iface = this; + iface = this; } else { diff --git a/src/Microsoft.DotNet.Wpf/src/PresentationFramework/System/Windows/Automation/Peers/GroupItemAutomationPeer.cs b/src/Microsoft.DotNet.Wpf/src/PresentationFramework/System/Windows/Automation/Peers/GroupItemAutomationPeer.cs index a3c38c4e167..e205f79c15f 100644 --- a/src/Microsoft.DotNet.Wpf/src/PresentationFramework/System/Windows/Automation/Peers/GroupItemAutomationPeer.cs +++ b/src/Microsoft.DotNet.Wpf/src/PresentationFramework/System/Windows/Automation/Peers/GroupItemAutomationPeer.cs @@ -150,7 +150,9 @@ protected override List GetChildrenCore() if (itemsHost == null) { if (_expanderPeer == null) + { return null; + } else { children.Add(_expanderPeer);