Fix the right arrow button of CalculationResult not disappearing in some cases (#736)
This commit is contained in:
		@@ -87,6 +87,12 @@ void CalculationResult::OnApplyTemplate()
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    if (m_textBlock != nullptr && m_textBlockSizeChangedToken.Value != 0)
 | 
			
		||||
    {
 | 
			
		||||
        m_textBlock->SizeChanged -= m_textBlockSizeChangedToken;
 | 
			
		||||
        m_textBlockSizeChangedToken.Value = 0;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    if (m_scrollLeft != nullptr && m_scrollLeftClickToken.Value != 0)
 | 
			
		||||
    {
 | 
			
		||||
        m_scrollLeft->Click -= m_scrollLeftClickToken;
 | 
			
		||||
@@ -128,6 +134,7 @@ void CalculationResult::OnApplyTemplate()
 | 
			
		||||
        if (m_textBlock)
 | 
			
		||||
        {
 | 
			
		||||
            m_textBlock->Visibility = ::Visibility::Visible;
 | 
			
		||||
            m_textBlockSizeChangedToken = m_textBlock->SizeChanged += ref new SizeChangedEventHandler(this, &CalculationResult::OnTextBlockSizeChanged);
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
    UpdateVisualState();
 | 
			
		||||
@@ -417,3 +424,8 @@ void CalculationResult::OnTextContainerOnViewChanged(Object ^ /*sender*/, Scroll
 | 
			
		||||
{
 | 
			
		||||
    UpdateScrollButtons();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void CalculationResult::OnTextBlockSizeChanged(Object ^ /*sender*/, SizeChangedEventArgs ^ /*e*/)
 | 
			
		||||
{
 | 
			
		||||
    UpdateScrollButtons();
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -56,6 +56,7 @@ namespace CalculatorApp
 | 
			
		||||
            void OnMinFontSizePropertyChanged(double oldValue, double newValue);
 | 
			
		||||
            void OnMaxFontSizePropertyChanged(double oldValue, double newValue);
 | 
			
		||||
            void OnTextContainerSizeChanged(Object ^ sender, Windows::UI::Xaml::SizeChangedEventArgs ^ e);
 | 
			
		||||
            void OnTextBlockSizeChanged(Object ^ sender, Windows::UI::Xaml::SizeChangedEventArgs ^ e);
 | 
			
		||||
            void OnTextContainerLayoutUpdated(Object ^ sender, Object ^ e);
 | 
			
		||||
            void OnTextContainerOnViewChanged(Object ^ sender, Windows::UI::Xaml::Controls::ScrollViewerViewChangedEventArgs ^ e);
 | 
			
		||||
            void UpdateVisualState();
 | 
			
		||||
@@ -82,6 +83,7 @@ namespace CalculatorApp
 | 
			
		||||
            Windows::Foundation::EventRegistrationToken m_textContainerSizeChangedToken;
 | 
			
		||||
            Windows::Foundation::EventRegistrationToken m_scrollRightClickToken;
 | 
			
		||||
            Windows::Foundation::EventRegistrationToken m_scrollLeftClickToken;
 | 
			
		||||
            Windows::Foundation::EventRegistrationToken m_textBlockSizeChangedToken;            
 | 
			
		||||
        };
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user