From d68f4642f7aecc71d869a7a799ab4f2b91c26b5a Mon Sep 17 00:00:00 2001 From: Martin Zikmund Date: Mon, 4 Oct 2021 16:04:33 +0200 Subject: [PATCH] Remove LosingFocus from PipsPager --- dev/PipsPager/PipsPager.cpp | 23 ++--------------------- dev/PipsPager/PipsPager.h | 1 - 2 files changed, 2 insertions(+), 22 deletions(-) diff --git a/dev/PipsPager/PipsPager.cpp b/dev/PipsPager/PipsPager.cpp index 27c8536b34..74facc2eaf 100755 --- a/dev/PipsPager/PipsPager.cpp +++ b/dev/PipsPager/PipsPager.cpp @@ -562,22 +562,6 @@ void PipsPager::OnGotFocus(const winrt::RoutedEventArgs& args) } } -// In order to avoid switching visibility of the navigation buttons while moving focus inside the Pager, -// we'll check if the next focused element is inside the Pager. -void PipsPager::LosingFocus(const IInspectable& sender, const winrt::LosingFocusEventArgs& args) -{ - if (const auto repeater = m_pipsPagerRepeater.get()) - { - if (const auto nextFocusElement = args.NewFocusedElement().try_as()) - { - m_ifNextFocusElementInside = repeater.GetElementIndex(nextFocusElement) != -1 - || nextFocusElement == m_previousPageButton.get() - || nextFocusElement == m_nextPageButton.get(); - - } - } -} - void PipsPager::OnPipsAreaGettingFocus(const IInspectable& sender, const winrt::GettingFocusEventArgs& args) { if (const auto repeater = m_pipsPagerRepeater.get()) @@ -615,11 +599,8 @@ void PipsPager::OnPipsAreaGettingFocus(const IInspectable& sender, const winrt:: void PipsPager::OnLostFocus(const winrt::RoutedEventArgs& args) { - if (!m_ifNextFocusElementInside) - { - m_isFocused = false; - UpdateNavigationButtonVisualStates(); - } + m_isFocused = false; + UpdateNavigationButtonVisualStates(); } void PipsPager::OnPointerEntered(const winrt::PointerRoutedEventArgs& args) diff --git a/dev/PipsPager/PipsPager.h b/dev/PipsPager/PipsPager.h index f051dd7d0e..daeeba208c 100755 --- a/dev/PipsPager/PipsPager.h +++ b/dev/PipsPager/PipsPager.h @@ -107,5 +107,4 @@ class PipsPager : int m_lastSelectedPageIndex{ -1 }; bool m_isPointerOver{ false }; bool m_isFocused{ false }; - bool m_ifNextFocusElementInside{ false }; };