Add decimal button on NumPad for all platform

This commit is contained in:
Yohan Guerin 2019-05-27 17:24:43 -04:00
commit ba179a4004
7 changed files with 969 additions and 943 deletions

View file

@ -480,6 +480,15 @@
Value="{StaticResource CalcOperatorCaptionSize}" />
</Style>
<Style x:Key="DecimalButtonStyle"
BasedOn="{StaticResource OperatorButtonStyle}"
TargetType="Controls:CalculatorButton">
<Setter Property="FontWeight"
Value="Bold" />
<Setter Property="FontSize"
Value="24" />
</Style>
<Style x:Key="SymbolOperatorButtonStyle"
BasedOn="{StaticResource OperatorButtonStyle}"
TargetType="Controls:CalculatorButton">

View file

@ -424,7 +424,8 @@
Grid.RowSpan="4"
Grid.Column="2"
Grid.ColumnSpan="3"
ButtonStyle="{StaticResource NumericButtonStyle18}" />
ButtonStyle="{StaticResource NumericButtonStyle18}"
DecimalButtonStyle="{StaticResource DecimalButtonStyle}" />
<controls:CalculatorButton x:Name="aButton"
x:Uid="aButton"

View file

@ -1034,6 +1034,7 @@
Grid.Column="6"
Grid.ColumnSpan="3"
AutomationProperties.HeadingLevel="Level1"
ButtonStyle="{StaticResource NumericButtonStyle24}" />
ButtonStyle="{StaticResource NumericButtonStyle24}"
DecimalButtonStyle="{StaticResource DecimalButtonStyle}" />
</Grid>
</UserControl>

View file

@ -605,7 +605,8 @@
Grid.Column="2"
Grid.ColumnSpan="3"
AutomationProperties.HeadingLevel="Level1"
ButtonStyle="{StaticResource NumericButtonStyle24}" />
ButtonStyle="{StaticResource NumericButtonStyle24}"
DecimalButtonStyle="{StaticResource DecimalButtonStyle}" />
<controls:CalculatorButton x:Name="negateButton"
x:Uid="negateButton"

View file

@ -118,10 +118,9 @@
-->
<controls:CalculatorButton x:Name="decimalSeparatorButton"
x:Uid="decimalSeparatorButton"
Grid.Row="4"
Grid.Row="3"
Grid.Column="2"
Style="{Binding ElementName=ControlRoot, Path=ButtonStyle}"
Background="{ThemeResource AppBackgroundAltMediumLowBrush}"
Style="{x:Bind Path=DecimalButtonStyle, Mode=OneWay}"
AutomationProperties.AutomationId="decimalSeparatorButton"
ButtonId="Decimal"
IsEnabled="{Binding IsDecimalEnabled}" />

View file

@ -22,6 +22,7 @@ namespace CalculatorApp
{
public sealed partial class NumberPad : UserControl
{
#region ButtonStyle
public Style ButtonStyle
{
get { return (Style)GetValue(ButtonStyleProperty); }
@ -30,7 +31,20 @@ namespace CalculatorApp
// Using a DependencyProperty as the backing store for ButtonStyle. This enables animation, styling, binding, etc...
public static readonly DependencyProperty ButtonStyleProperty =
DependencyProperty.Register("ButtonStyle", typeof(Style), typeof(NumberPad), new PropertyMetadata(null));
DependencyProperty.Register(nameof(ButtonStyle), typeof(Style), typeof(NumberPad), new PropertyMetadata(null));
#endregion
#region DecimalButtonStyle
public Style DecimalButtonStyle
{
get { return (Style)GetValue(DecimalButtonStyleProperty); }
set { SetValue(DecimalButtonStyleProperty, value); }
}
public static readonly DependencyProperty DecimalButtonStyleProperty =
DependencyProperty.Register(nameof(DecimalButtonStyle), typeof(Style), typeof(NumberPad), new PropertyMetadata(null));
#endregion
private bool m_isErrorVisualState;
public NumberPad()

View file

@ -857,6 +857,7 @@
VerticalAlignment="Stretch"
AutomationProperties.HeadingLevel="Level1"
ButtonStyle="{StaticResource NumericButtonStyle24}"
DecimalButtonStyle="{StaticResource DecimalButtonStyle}"
TabIndex="10"
TabNavigation="Local"/>
<controls:CalculatorButton x:Name="ConverterNegateButton"