From b8f6afa080193daa520bcaef06bd1d63368f0467 Mon Sep 17 00:00:00 2001 From: "Dr.Rx" Date: Fri, 24 May 2019 23:22:46 -0400 Subject: [PATCH] Enable result text scalling when too long --- .../Controls/CalculationResult.cs | 11 +++++-- src/Calculator.Shared/Styles.xaml | 32 +++++++++---------- 2 files changed, 25 insertions(+), 18 deletions(-) diff --git a/src/Calculator.Shared/Controls/CalculationResult.cs b/src/Calculator.Shared/Controls/CalculationResult.cs index 4dd734ff..fb97ab0c 100644 --- a/src/Calculator.Shared/Controls/CalculationResult.cs +++ b/src/Calculator.Shared/Controls/CalculationResult.cs @@ -60,7 +60,7 @@ namespace CalculatorApp propertyType: typeof(double), ownerType: typeof(CalculationResult), typeMetadata: new PropertyMetadata( - defaultValue: 30.0, + defaultValue: 42.0, propertyChangedCallback: (s, e) => (s as CalculationResult)?.OnMaxFontSizePropertyChanged( (double)e.OldValue, (double)e.NewValue))); @@ -216,7 +216,9 @@ namespace CalculatorApp m_textContainer.SizeChanged += TextContainerSizeChanged; // We want to know when the size of the container changes so // we can rescale the textbox +#if NETFX_CORE // TODO UNO: We listen on m_textBlock instead m_textContainer.LayoutUpdated += OnTextContainerLayoutUpdated; +#endif m_textContainer.ChangeView(m_textContainer.ExtentWidth - m_textContainer.ViewportWidth, null, null); m_scrollLeft = (HyperlinkButton)(GetTemplateChild("ScrollLeft")); @@ -233,6 +235,9 @@ namespace CalculatorApp if (m_textBlock != null) { m_textBlock.Visibility = Visibility.Visible; +#if !NETFX_CORE // TODO UNO: We should be listening on m_textContainer + m_textBlock.LayoutUpdated += OnTextContainerLayoutUpdated; +#endif } } UpdateAllState(); @@ -337,7 +342,9 @@ namespace CalculatorApp var containerSize = m_textContainer.ActualWidth; string oldText = m_textBlock.Text; - string newText = Utils.LRO + DisplayValue + Utils.PDF; + //string newText = Utils.LRO + DisplayValue + Utils.PDF; + // TODO UNO + string newText = DisplayValue; // Initiate the scaling operation // UpdateLayout will keep calling us until we make it through the below 2 if-statements diff --git a/src/Calculator.Shared/Styles.xaml b/src/Calculator.Shared/Styles.xaml index 045f6554..fecbd691 100644 --- a/src/Calculator.Shared/Styles.xaml +++ b/src/Calculator.Shared/Styles.xaml @@ -629,7 +629,7 @@ - @@ -641,18 +641,18 @@ - - - - - - - @@ -730,7 +730,7 @@ - @@ -744,20 +744,20 @@ - - - - - - -