From e2a02d8014b012160761dd3e9c847954a489611d Mon Sep 17 00:00:00 2001 From: Brownard Date: Sat, 25 Oct 2014 09:07:48 +0100 Subject: [PATCH] Check if any child ScrollViewers can handle key press before checking parent --- .../Source/UI/SkinEngine/Controls/Visuals/ScrollViewer.cs | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/MediaPortal/Source/UI/SkinEngine/Controls/Visuals/ScrollViewer.cs b/MediaPortal/Source/UI/SkinEngine/Controls/Visuals/ScrollViewer.cs index 261cd97..20b00b1 100644 --- a/MediaPortal/Source/UI/SkinEngine/Controls/Visuals/ScrollViewer.cs +++ b/MediaPortal/Source/UI/SkinEngine/Controls/Visuals/ScrollViewer.cs @@ -483,9 +483,17 @@ namespace MediaPortal.UI.SkinEngine.Controls.Visuals // Key event was handeled by child return; - if (!CheckFocusInScope()) + ScrollViewer subScroller; + if (!CheckFocusInScope(out subScroller)) return; + if (subScroller != null) + { + subScroller.OnKeyPressed(ref key); + if (key == Key.None) + return; + } + if (key == Key.Down && OnDown()) key = Key.None; else if (key == Key.Up && OnUp()) @@ -509,8 +517,9 @@ namespace MediaPortal.UI.SkinEngine.Controls.Visuals /// is not contained in a sub scrollviewer. This is necessary for this scrollviewer to /// handle the focus scrolling keys in this scope. /// - bool CheckFocusInScope() + bool CheckFocusInScope(out ScrollViewer subScroller) { + subScroller = null; Screen screen = Screen; Visual focusPath = screen == null ? null : screen.FocusedElement; while (focusPath != null) @@ -520,7 +529,7 @@ namespace MediaPortal.UI.SkinEngine.Controls.Visuals return true; if (focusPath is ScrollViewer) // Focused control is located in another scrollviewer's focus scope - return false; + subScroller = (ScrollViewer)focusPath; //return false; focusPath = focusPath.VisualParent; } return false; -- 1.8.1.msysgit.1