Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions src/Calculator/Controls/RadixButton.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
// Licensed under the MIT License.

using CalculatorApp.ViewModel.Common;
using Windows.UI.Xaml;

namespace CalculatorApp
{
Expand All @@ -17,6 +18,15 @@ internal string GetRawDisplayValue()
string radixContent = Content?.ToString();
return LocalizationSettings.GetInstance().RemoveGroupSeparators(radixContent);
}

public string Label
{
get => (string)GetValue(LabelProperty);
set => SetValue(LabelProperty, value);
}

public static readonly DependencyProperty LabelProperty =
DependencyProperty.Register(nameof(Label), typeof(string), typeof(RadixButton), new PropertyMetadata(default(string)));
}
}
}
8 changes: 4 additions & 4 deletions src/Calculator/Resources/en-US/Resources.resw
Original file line number Diff line number Diff line change
Expand Up @@ -145,19 +145,19 @@
<value>AppUpdate2</value>
<comment>{Locked}This will Update Resources.pri File, Resource is not used in the app</comment>
</data>
<data name="decimalButton.Tag" xml:space="preserve">
<data name="decimalButton.Label" xml:space="preserve">
<value>DEC</value>
<comment>{Locked}The Decimal button</comment>
</data>
<data name="binaryButton.Tag" xml:space="preserve">
<data name="binaryButton.Label" xml:space="preserve">
<value>BIN</value>
<comment>{Locked}The Binary button</comment>
</data>
<data name="hexButton.Tag" xml:space="preserve">
<data name="hexButton.Label" xml:space="preserve">
<value>HEX</value>
<comment>{Locked}The Hex button</comment>
</data>
<data name="octButton.Tag" xml:space="preserve">
<data name="octButton.Label" xml:space="preserve">
<value>OCT</value>
<comment>{Locked}The Oct button</comment>
</data>
Expand Down
20 changes: 10 additions & 10 deletions src/Calculator/Views/CalculatorProgrammerOperators.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

<UserControl.Resources>
<!-- Programmer mode display radio button -->
<Style x:Key="ProgModeRadioButtonStyle" TargetType="RadioButton">
<Style x:Key="ProgModeRadioButtonStyle" TargetType="controls:RadixButton">
<Setter Property="Foreground" Value="{ThemeResource TextFillColorPrimaryBrush}"/>
<Setter Property="MinHeight" Value="12"/>
<Setter Property="MinWidth" Value="280"/>
Expand All @@ -32,7 +32,7 @@
<Setter Property="FocusVisualMargin" Value="-3"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="RadioButton">
<ControlTemplate TargetType="controls:RadixButton">
<Grid x:Name="ControlRoot"
VerticalAlignment="Stretch"
Background="{ThemeResource SubtleFillColorTransparentBrush}"
Expand Down Expand Up @@ -106,7 +106,7 @@
FontWeight="{TemplateBinding FontWeight}"
AutomationProperties.AccessibilityView="Raw"
IsTextScaleFactorEnabled="{TemplateBinding IsTextScaleFactorEnabled}"
Text="{TemplateBinding Tag}"/>
Text="{TemplateBinding Label}"/>
</Grid>
<Grid x:Name="CheckedStatesGrid"
Background="{ThemeResource SystemControlHighlightTransparentBrush}"
Expand Down Expand Up @@ -149,7 +149,7 @@
FontWeight="{TemplateBinding FontWeight}"
AutomationProperties.AccessibilityView="Raw"
IsTextScaleFactorEnabled="{TemplateBinding IsTextScaleFactorEnabled}"
Text="{TemplateBinding Tag}"/>
Text="{TemplateBinding Label}"/>
</Grid>
</Grid>
</ControlTemplate>
Expand All @@ -158,10 +158,10 @@
</Style>
<contract7NotPresent:Style x:Key="ConditionalProgModeRadioButtonStyle"
BasedOn="{StaticResource ProgModeRadioButtonStyle}"
TargetType="RadioButton"/>
TargetType="controls:RadixButton"/>
<contract7Present:Style x:Key="ConditionalProgModeRadioButtonStyle"
BasedOn="{StaticResource ProgModeRadioButtonStyle}"
TargetType="RadioButton">
TargetType="controls:RadixButton">
<Setter Property="CornerRadius" Value="{ThemeResource ControlCornerRadius}"/>
</contract7Present:Style>

Expand Down Expand Up @@ -214,7 +214,7 @@
Content="{x:Bind Model.HexDisplayValue, Mode=OneWay}"
ContextFlyout="{StaticResource ProgrammerOperatorsContextMenu}"
GroupName="BaseConversion"
Tag="{utils:ResourceString Name=hexButton/Tag}"/>
Label="{utils:ResourceString Name=hexButton/Label}"/>
<controls:RadixButton x:Name="DecimalButton"
Grid.Row="1"
HorizontalAlignment="Stretch"
Expand All @@ -227,7 +227,7 @@
ContextFlyout="{StaticResource ProgrammerOperatorsContextMenu}"
GroupName="BaseConversion"
IsChecked="true"
Tag="{utils:ResourceString Name=decimalButton/Tag}"/>
Label="{utils:ResourceString Name=decimalButton/Label}"/>
<controls:RadixButton x:Name="OctButton"
Grid.Row="2"
HorizontalAlignment="Stretch"
Expand All @@ -239,7 +239,7 @@
Content="{x:Bind Model.OctalDisplayValue, Mode=OneWay}"
ContextFlyout="{StaticResource ProgrammerOperatorsContextMenu}"
GroupName="BaseConversion"
Tag="{utils:ResourceString Name=octButton/Tag}"/>
Label="{utils:ResourceString Name=octButton/Label}"/>
<controls:RadixButton x:Name="BinaryButton"
Grid.Row="3"
HorizontalAlignment="Stretch"
Expand All @@ -251,6 +251,6 @@
Content="{x:Bind Model.BinaryDisplayValue, Mode=OneWay}"
ContextFlyout="{StaticResource ProgrammerOperatorsContextMenu}"
GroupName="BaseConversion"
Tag="{utils:ResourceString Name=binaryButton/Tag}"/>
Label="{utils:ResourceString Name=binaryButton/Label}"/>
</Grid>
</UserControl>
Loading