remove the useless code related to the management of the focus in CalculationResult (#700)

This commit is contained in:
Rudy Huyn 2020-01-06 15:21:29 -08:00 committed by Matt Cooley
parent 22f57aab3f
commit 7f2c300e37
2 changed files with 1 additions and 24 deletions

View File

@ -52,9 +52,6 @@ DEPENDENCY_PROPERTY_INITIALIZATION(CalculationResult, DisplayStringExpression);
// and no events are launched when they scroll again in the same direction // and no events are launched when they scroll again in the same direction
#define SCROLL_BUTTONS_APPROXIMATION_RANGE 4 #define SCROLL_BUTTONS_APPROXIMATION_RANGE 4
StringReference CalculationResult::s_FocusedState(L"Focused");
StringReference CalculationResult::s_UnfocusedState(L"Unfocused");
CalculationResult::CalculationResult() CalculationResult::CalculationResult()
: m_isScalingText(false) : m_isScalingText(false)
, m_haveCalculatedMax(false) , m_haveCalculatedMax(false)
@ -139,7 +136,6 @@ void CalculationResult::OnApplyTemplate()
} }
UpdateVisualState(); UpdateVisualState();
UpdateTextState(); UpdateTextState();
VisualStateManager::GoToState(this, s_UnfocusedState, false);
} }
void CalculationResult::OnTextContainerLayoutUpdated(Object ^ /*sender*/, Object ^ /*e*/) void CalculationResult::OnTextContainerLayoutUpdated(Object ^ /*sender*/, Object ^ /*e*/)
@ -392,19 +388,6 @@ void CalculationResult::OnRightTapped(RightTappedRoutedEventArgs ^ e)
} }
} }
void CalculationResult::OnGotFocus(RoutedEventArgs ^ e)
{
if (this->FocusState == ::FocusState::Keyboard)
{
VisualStateManager::GoToState(this, s_FocusedState, true);
}
}
void CalculationResult::OnLostFocus(RoutedEventArgs ^ e)
{
VisualStateManager::GoToState(this, s_UnfocusedState, true);
}
AutomationPeer ^ CalculationResult::OnCreateAutomationPeer() AutomationPeer ^ CalculationResult::OnCreateAutomationPeer()
{ {
return ref new CalculationResultAutomationPeer(this); return ref new CalculationResultAutomationPeer(this);

View File

@ -43,9 +43,7 @@ namespace CalculatorApp
virtual void OnApplyTemplate() override; virtual void OnApplyTemplate() override;
virtual void OnTapped(Windows::UI::Xaml::Input::TappedRoutedEventArgs ^ e) override; virtual void OnTapped(Windows::UI::Xaml::Input::TappedRoutedEventArgs ^ e) override;
virtual void OnRightTapped(Windows::UI::Xaml::Input::RightTappedRoutedEventArgs ^ e) override; virtual void OnRightTapped(Windows::UI::Xaml::Input::RightTappedRoutedEventArgs ^ e) override;
virtual void OnGotFocus(Windows::UI::Xaml::RoutedEventArgs ^ e) override;
virtual void OnLostFocus(Windows::UI::Xaml::RoutedEventArgs ^ e) override;
virtual Windows::UI::Xaml::Automation::Peers::AutomationPeer ^ OnCreateAutomationPeer() override; virtual Windows::UI::Xaml::Automation::Peers::AutomationPeer ^ OnCreateAutomationPeer() override;
private: private:
@ -67,10 +65,6 @@ namespace CalculatorApp
void ScrollRight(); void ScrollRight();
void RaiseSelectedEvent(); void RaiseSelectedEvent();
// Visual states for focused
static Platform::StringReference s_FocusedState;
static Platform::StringReference s_UnfocusedState;
Windows::UI::Xaml::Controls::ScrollViewer ^ m_textContainer; Windows::UI::Xaml::Controls::ScrollViewer ^ m_textContainer;
Windows::UI::Xaml::Controls::TextBlock ^ m_textBlock; Windows::UI::Xaml::Controls::TextBlock ^ m_textBlock;
Windows::UI::Xaml::Controls::HyperlinkButton ^ m_scrollLeft; Windows::UI::Xaml::Controls::HyperlinkButton ^ m_scrollLeft;