This commit is contained in:
Hexer611 2025-08-20 13:39:12 +03:00 committed by GitHub
commit 0e3e5b67aa
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 24 additions and 14 deletions

View file

@ -2,6 +2,7 @@
// Licensed under the MIT License.
using CalculatorApp.ViewModel.Common;
using Windows.UI.Xaml;
namespace CalculatorApp
{
@ -17,6 +18,15 @@ namespace CalculatorApp
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)));
}
}
}

View file

@ -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>

View file

@ -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"/>
@ -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}"
@ -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}"
@ -149,7 +149,7 @@
FontWeight="{TemplateBinding FontWeight}"
AutomationProperties.AccessibilityView="Raw"
IsTextScaleFactorEnabled="{TemplateBinding IsTextScaleFactorEnabled}"
Text="{TemplateBinding Tag}"/>
Text="{TemplateBinding Label}"/>
</Grid>
</Grid>
</ControlTemplate>
@ -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>
@ -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"
@ -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"
@ -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"
@ -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>