From 4052d6e020253166c5de6eefe2e25b6157ca9c0e Mon Sep 17 00:00:00 2001 From: Ben Wallis Date: Wed, 5 Dec 2018 20:26:01 +0000 Subject: [PATCH] Fixed ScrollViewer event handling special casing --- Filtration/Views/ItemFilterBlockView.xaml.cs | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/Filtration/Views/ItemFilterBlockView.xaml.cs b/Filtration/Views/ItemFilterBlockView.xaml.cs index f5a915e..d28ade2 100644 --- a/Filtration/Views/ItemFilterBlockView.xaml.cs +++ b/Filtration/Views/ItemFilterBlockView.xaml.cs @@ -45,8 +45,8 @@ namespace Filtration.Views { // Don't handle events if they originated from a control within an EditableListBoxControl // or a ComboBox since we still want to allow scrolling within those with the mouse wheel - if (e.OriginalSource is DependencyObject dependencyObject && (VisualTreeUtility.FindParent(dependencyObject) != null || - IsDropDownScrollViewer(dependencyObject))) + if (e.OriginalSource is DependencyObject dependencyObject && (IsDropDownScrollViewer(dependencyObject) || ParentIsEditableListBoxControl(dependencyObject) || + ParentIsDropDownScrollViewer(dependencyObject))) { e.Handled = false; return; @@ -62,10 +62,19 @@ namespace Filtration.Views } } - private bool IsDropDownScrollViewer(DependencyObject dependencyObject) + private static bool ParentIsEditableListBoxControl(DependencyObject dependencyObject) + { + return VisualTreeUtility.FindParent(dependencyObject) != null; + } + private static bool ParentIsDropDownScrollViewer(DependencyObject dependencyObject) { var parent = VisualTreeUtility.FindParent(dependencyObject); return parent != null && parent.Name == "DropDownScrollViewer"; } + + private static bool IsDropDownScrollViewer(DependencyObject dependencyObject) + { + return dependencyObject is ScrollViewer scrollViewer && scrollViewer.Name == "DropDownScrollViewer"; + } } }