mirror of
https://github.com/Microsoft/calculator.git
synced 2025-08-22 22:23:29 -07:00
Merge pull request #56 from nventive/dev/dr/ResultScale
Enable result text scalling when too long
This commit is contained in:
commit
336080169e
2 changed files with 25 additions and 18 deletions
|
@ -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
|
||||
|
|
|
@ -629,7 +629,7 @@
|
|||
<Setter Property="Template">
|
||||
<Setter.Value>
|
||||
<ControlTemplate TargetType="Controls:CalculationResult">
|
||||
<Grid x:Name="border"
|
||||
<Grid x:Name="Border"
|
||||
Background="{TemplateBinding Background}">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="12" />
|
||||
|
@ -641,18 +641,18 @@
|
|||
<VisualState x:Name="Active" />
|
||||
<VisualState x:Name="Normal">
|
||||
<VisualState.Setters>
|
||||
<Setter Target="normalOutput.FontWeight"
|
||||
<Setter Target="NormalOutput.FontWeight"
|
||||
Value="Light" />
|
||||
</VisualState.Setters>
|
||||
</VisualState>
|
||||
</VisualStateGroup>
|
||||
</VisualStateManager.VisualStateGroups>
|
||||
<ScrollViewer x:Name="textContainer"
|
||||
<ScrollViewer x:Name="TextContainer"
|
||||
Grid.Column="1"
|
||||
Padding="0,0,0,0"
|
||||
Style="{ThemeResource ResultsScrollerSnapped}"
|
||||
AutomationProperties.AccessibilityView="Raw">
|
||||
<TextBlock x:Name="normalOutput"
|
||||
<TextBlock x:Name="NormalOutput"
|
||||
Margin="{TemplateBinding DisplayMargin}"
|
||||
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
|
||||
VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
|
||||
|
@ -664,7 +664,7 @@
|
|||
TextAlignment="{TemplateBinding HorizontalContentAlignment}"
|
||||
TextWrapping="NoWrap" />
|
||||
</ScrollViewer>
|
||||
<HyperlinkButton x:Name="scrollLeft"
|
||||
<HyperlinkButton x:Name="ScrollLeft"
|
||||
Grid.Column="0"
|
||||
Width="20"
|
||||
MinWidth="20"
|
||||
|
@ -677,12 +677,12 @@
|
|||
Foreground="{ThemeResource SystemControlForegroundAccentBrush}"
|
||||
BorderThickness="0"
|
||||
Visibility="Collapsed">
|
||||
<FontIcon x:Name="scrollLeftText"
|
||||
<FontIcon x:Name="ScrollLeftText"
|
||||
FontFamily="{ThemeResource SymbolThemeFontFamily}"
|
||||
FontSize="12"
|
||||
Glyph="" />
|
||||
</HyperlinkButton>
|
||||
<HyperlinkButton x:Name="scrollRight"
|
||||
<HyperlinkButton x:Name="ScrollRight"
|
||||
Grid.Column="2"
|
||||
Width="20"
|
||||
MinWidth="20"
|
||||
|
@ -695,7 +695,7 @@
|
|||
Foreground="{ThemeResource SystemControlForegroundAccentBrush}"
|
||||
BorderThickness="0"
|
||||
Visibility="Collapsed">
|
||||
<FontIcon x:Name="scrollRightText"
|
||||
<FontIcon x:Name="ScrollRightText"
|
||||
FontFamily="{ThemeResource SymbolThemeFontFamily}"
|
||||
FontSize="12"
|
||||
Glyph="" />
|
||||
|
@ -730,7 +730,7 @@
|
|||
<Setter.Value>
|
||||
<ControlTemplate TargetType="Controls:CalculationResult">
|
||||
|
||||
<Grid x:Name="border"
|
||||
<Grid x:Name="Border"
|
||||
Background="{TemplateBinding Background}">
|
||||
|
||||
<Grid.ColumnDefinitions>
|
||||
|
@ -744,20 +744,20 @@
|
|||
<VisualState x:Name="Active" />
|
||||
<VisualState x:Name="Normal">
|
||||
<VisualState.Setters>
|
||||
<Setter Target="normalOutput.FontWeight"
|
||||
<Setter Target="NormalOutput.FontWeight"
|
||||
Value="Light" />
|
||||
</VisualState.Setters>
|
||||
</VisualState>
|
||||
</VisualStateGroup>
|
||||
</VisualStateManager.VisualStateGroups>
|
||||
|
||||
<ScrollViewer x:Name="textContainer"
|
||||
<ScrollViewer x:Name="TextContainer"
|
||||
Grid.Column="1"
|
||||
Padding="0,0,0,0"
|
||||
Style="{ThemeResource ResultsScrollerSnapped}"
|
||||
AutomationProperties.AccessibilityView="Raw">
|
||||
|
||||
<TextBlock x:Name="normalOutput"
|
||||
<TextBlock x:Name="NormalOutput"
|
||||
Margin="{TemplateBinding DisplayMargin}"
|
||||
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
|
||||
VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
|
||||
|
@ -770,7 +770,7 @@
|
|||
TextWrapping="NoWrap" />
|
||||
</ScrollViewer>
|
||||
|
||||
<HyperlinkButton x:Name="scrollLeft"
|
||||
<HyperlinkButton x:Name="ScrollLeft"
|
||||
Grid.Column="0"
|
||||
Width="20"
|
||||
MinWidth="20"
|
||||
|
@ -783,13 +783,13 @@
|
|||
Foreground="{ThemeResource SystemControlForegroundAccentBrush}"
|
||||
BorderThickness="0"
|
||||
Visibility="Collapsed">
|
||||
<FontIcon x:Name="scrollLeftText"
|
||||
<FontIcon x:Name="ScrollLeftText"
|
||||
FontFamily="{ThemeResource SymbolThemeFontFamily}"
|
||||
FontSize="12"
|
||||
Glyph="" />
|
||||
</HyperlinkButton>
|
||||
|
||||
<HyperlinkButton x:Name="scrollRight"
|
||||
<HyperlinkButton x:Name="ScrollRight"
|
||||
Grid.Column="2"
|
||||
Width="20"
|
||||
MinWidth="20"
|
||||
|
@ -802,7 +802,7 @@
|
|||
Foreground="{ThemeResource SystemControlForegroundAccentBrush}"
|
||||
BorderThickness="0"
|
||||
Visibility="Collapsed">
|
||||
<FontIcon x:Name="scrollRightText"
|
||||
<FontIcon x:Name="ScrollRightText"
|
||||
FontFamily="{ThemeResource SymbolThemeFontFamily}"
|
||||
FontSize="12"
|
||||
Glyph="" />
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue