Skip to content

Commit 9322de6

Browse files
authored
Merge branch 'master' into feature/net-5-target
2 parents c85af73 + 001c5c4 commit 9322de6

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

Microsoft.Toolkit.Uwp.UI.Animations/Behaviors/StickyHeaderBehavior.cs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
using Windows.UI.Xaml.Controls;
1212
using Windows.UI.Xaml.Hosting;
1313
using Windows.UI.Xaml.Input;
14+
using Windows.UI.Xaml.Media;
1415

1516
namespace Microsoft.Toolkit.Uwp.UI.Animations.Behaviors
1617
{
@@ -238,7 +239,9 @@ private void ScrollViewer_GotFocus(object sender, RoutedEventArgs e)
238239
focusedElement = FocusManager.GetFocusedElement();
239240
}
240241

241-
if (focusedElement is UIElement element)
242+
// To prevent Popups (Flyouts...) from triggering the autoscroll, we check if the focused element has a valid parent.
243+
// Popups have no parents, whereas a normal Item would have the ListView as a parent.
244+
if (focusedElement is UIElement element && VisualTreeHelper.GetParent(element) != null)
242245
{
243246
FrameworkElement header = (FrameworkElement)HeaderElement;
244247

0 commit comments

Comments
 (0)