forked from microsoft/calculator
-
Notifications
You must be signed in to change notification settings - Fork 0
/
CalculatorProgrammerOperators.xaml
251 lines (247 loc) · 16.4 KB
/
CalculatorProgrammerOperators.xaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
<UserControl x:Class="CalculatorApp.CalculatorProgrammerOperators"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:common="using:CalculatorApp.Common"
xmlns:contract7NotPresent="http://schemas.microsoft.com/winfx/2006/xaml/presentation?IsApiContractNotPresent(Windows.Foundation.UniversalApiContract,7)"
xmlns:contract7Present="http://schemas.microsoft.com/winfx/2006/xaml/presentation?IsApiContractPresent(Windows.Foundation.UniversalApiContract,7)"
xmlns:controls="using:CalculatorApp.Controls"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:designdata="using:CalculatorApp.DesignData"
xmlns:local="using:CalculatorApp"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
x:Name="ControlRoot"
d:DesignHeight="400"
d:DesignWidth="315"
mc:Ignorable="d">
<UserControl.Resources>
<!-- Programmer mode display radio button -->
<Style x:Key="ProgModeRadioButtonStyle" TargetType="RadioButton">
<Setter Property="Foreground" Value="{ThemeResource TextFillColorPrimaryBrush}"/>
<Setter Property="MinHeight" Value="12"/>
<Setter Property="MinWidth" Value="280"/>
<Setter Property="MaxHeight" Value="60"/>
<Setter Property="VerticalAlignment" Value="Stretch"/>
<Setter Property="HorizontalAlignment" Value="Stretch"/>
<Setter Property="Padding" Value="8,0,0,0"/>
<Setter Property="Typography.NumeralAlignment" Value="Tabular"/>
<Setter Property="FontSize" Value="{ThemeResource CaptionFontSize}"/>
<Setter Property="FontWeight" Value="Normal"/>
<Setter Property="IsTextScaleFactorEnabled" Value="True"/>
<Setter Property="FocusVisualMargin" Value="-3"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="RadioButton">
<Grid x:Name="ControlRoot"
VerticalAlignment="Stretch"
Background="{ThemeResource SubtleFillColorTransparentBrush}"
contract7Present:CornerRadius="{TemplateBinding CornerRadius}">
<VisualStateManager.VisualStateGroups>
<VisualStateGroup x:Name="CommonStates">
<VisualState x:Name="Normal"/>
<VisualState x:Name="PointerOver">
<VisualState.Setters>
<Setter Target="ControlRoot.Background" Value="{ThemeResource SubtleFillColorSecondaryBrush}"/>
</VisualState.Setters>
</VisualState>
<VisualState x:Name="Pressed">
<VisualState.Setters>
<Setter Target="ControlRoot.Background" Value="{ThemeResource SubtleFillColorTertiaryBrush}"/>
<Setter Target="ContentPresenter.Foreground" Value="{ThemeResource TextFillColorSecondaryBrush}"/>
<Setter Target="LabelPresenter.Foreground" Value="{ThemeResource TextFillColorSecondaryBrush}"/>
</VisualState.Setters>
</VisualState>
<VisualState x:Name="Disabled">
<VisualState.Setters>
<Setter Target="RevealBackplate.Visibility" Value="Collapsed"/>
</VisualState.Setters>
</VisualState>
</VisualStateGroup>
<VisualStateGroup x:Name="CheckStates">
<VisualState x:Name="Checked">
<VisualState.Setters>
<Setter Target="CheckedStatesGrid.Opacity" Value="1"/>
<Setter Target="NormalStatesGrid.Opacity" Value="0"/>
</VisualState.Setters>
</VisualState>
<VisualState x:Name="Unchecked"/>
<VisualState x:Name="Indeterminate"/>
</VisualStateGroup>
</VisualStateManager.VisualStateGroups>
<Border x:Name="RevealBackplate"
Margin="0,-1,0,0"
Background="{ThemeResource ListViewItemRevealBackground}"
BorderBrush="{ThemeResource ListViewItemRevealBorderBrush}"
BorderThickness="0,1,0,1"/>
<Grid x:Name="NormalStatesGrid">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="3"/>
<ColumnDefinition Width="Auto" MinWidth="48"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<TextBlock x:Name="ContentPresenter"
Grid.Column="2"
Margin="4,0,4,0"
HorizontalAlignment="Left"
VerticalAlignment="Center"
Foreground="{ThemeResource SystemControlForegroundBaseHighBrush}"
FontFamily="{TemplateBinding FontFamily}"
FontSize="{TemplateBinding FontSize}"
FontWeight="{TemplateBinding FontWeight}"
AutomationProperties.AccessibilityView="Raw"
IsTextScaleFactorEnabled="{TemplateBinding IsTextScaleFactorEnabled}"
Text="{TemplateBinding Content}"
TextWrapping="Wrap"/>
<TextBlock x:Name="LabelPresenter"
Grid.Column="1"
Margin="{TemplateBinding Padding}"
HorizontalAlignment="Left"
VerticalAlignment="Center"
Foreground="{ThemeResource SystemControlForegroundBaseHighBrush}"
FontFamily="{TemplateBinding FontFamily}"
FontSize="{TemplateBinding FontSize}"
FontWeight="{TemplateBinding FontWeight}"
AutomationProperties.AccessibilityView="Raw"
IsTextScaleFactorEnabled="{TemplateBinding IsTextScaleFactorEnabled}"
Text="{TemplateBinding Tag}"/>
</Grid>
<Grid x:Name="CheckedStatesGrid"
Background="{ThemeResource SystemControlHighlightTransparentBrush}"
Opacity="0">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="3"/>
<ColumnDefinition Width="Auto" MinWidth="48"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<Rectangle x:Name="CheckedRectangle"
Grid.Column="0"
MaxHeight="16"
Margin="0,5,0,5"
HorizontalAlignment="Stretch"
VerticalAlignment="Stretch"
Fill="{ThemeResource AccentFillColorDefaultBrush}"
RadiusX="1.5"
RadiusY="1.5"/>
<TextBlock x:Name="CheckedContentPresenter"
Grid.Column="2"
Margin="4,0,4,0"
HorizontalAlignment="Left"
VerticalAlignment="Center"
Foreground="{ThemeResource SystemControlHighlightAltBaseHighBrush}"
FontFamily="{TemplateBinding FontFamily}"
FontSize="{TemplateBinding FontSize}"
FontWeight="{TemplateBinding FontWeight}"
AutomationProperties.AccessibilityView="Raw"
IsTextScaleFactorEnabled="{TemplateBinding IsTextScaleFactorEnabled}"
Text="{TemplateBinding Content}"
TextWrapping="Wrap"/>
<TextBlock x:Name="CheckedLabelPresenter"
Grid.Column="1"
Margin="{TemplateBinding Padding}"
HorizontalAlignment="Left"
VerticalAlignment="Center"
Foreground="{ThemeResource SystemControlHighlightAltBaseHighBrush}"
FontFamily="{TemplateBinding FontFamily}"
FontSize="{TemplateBinding FontSize}"
FontWeight="{TemplateBinding FontWeight}"
AutomationProperties.AccessibilityView="Raw"
IsTextScaleFactorEnabled="{TemplateBinding IsTextScaleFactorEnabled}"
Text="{TemplateBinding Tag}"/>
</Grid>
</Grid>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<contract7NotPresent:Style x:Key="ConditionalProgModeRadioButtonStyle"
BasedOn="{StaticResource ProgModeRadioButtonStyle}"
TargetType="RadioButton"/>
<contract7Present:Style x:Key="ConditionalProgModeRadioButtonStyle"
BasedOn="{StaticResource ProgModeRadioButtonStyle}"
TargetType="RadioButton">
<Setter Property="CornerRadius" Value="{ThemeResource ControlCornerRadius}"/>
</contract7Present:Style>
<MenuFlyout x:Key="ProgrammerOperatorsContextMenu" x:Name="ProgrammerOperatorsContextMenu">
<MenuFlyoutItem x:Name="CopyMenuItem"
x:Uid="CopyMenuItem"
Click="OnCopyMenuItemClicked"
Icon="Copy"/>
</MenuFlyout>
</UserControl.Resources>
<Grid x:Name="ProgrammerOperators"
x:Uid="RadixGroup"
MaxHeight="244"
Margin="4,0"
AutomationProperties.HeadingLevel="Level1"
FlowDirection="LeftToRight">
<Grid.RowDefinitions>
<RowDefinition Height="1*" MinHeight="0"/>
<RowDefinition Height="1*" MinHeight="0"/>
<RowDefinition Height="1*" MinHeight="0"/>
<RowDefinition Height="1*" MinHeight="{Binding ActualHeight, ElementName=BinaryButton, FallbackValue=16, Mode=OneWay}"/>
<RowDefinition Height="4"/>
</Grid.RowDefinitions>
<VisualStateManager.VisualStateGroups>
<VisualStateGroup>
<VisualState x:Name="LargeLayout">
<VisualState.StateTriggers>
<AdaptiveTrigger MinWindowHeight="768" MinWindowWidth="1024"/>
</VisualState.StateTriggers>
</VisualState>
<VisualState x:Name="MinSizeLayout">
<VisualState.StateTriggers>
<AdaptiveTrigger MinWindowHeight="{StaticResource AppMinWindowHeight}" MinWindowWidth="{StaticResource AppMinWindowWidth}"/>
</VisualState.StateTriggers>
</VisualState>
<VisualState x:Name="DefaultLayout">
<VisualState.StateTriggers>
<AdaptiveTrigger MinWindowHeight="0" MinWindowWidth="0"/>
</VisualState.StateTriggers>
</VisualState>
</VisualStateGroup>
</VisualStateManager.VisualStateGroups>
<controls:RadixButton x:Name="HexButton"
x:Uid="hexButton"
HorizontalAlignment="Stretch"
Style="{ThemeResource ConditionalProgModeRadioButtonStyle}"
AutomationProperties.AutomationId="hexButton"
AutomationProperties.Name="{x:Bind Model.HexDisplayValue_AutomationName, Mode=OneWay}"
Checked="HexButtonChecked"
Content="{x:Bind Model.HexDisplayValue, Mode=OneWay}"
ContextFlyout="{StaticResource ProgrammerOperatorsContextMenu}"
GroupName="BaseConversion"/>
<controls:RadixButton x:Name="DecimalButton"
x:Uid="decimalButton"
Grid.Row="1"
HorizontalAlignment="Stretch"
Style="{ThemeResource ConditionalProgModeRadioButtonStyle}"
AutomationProperties.AutomationId="decimalButton"
AutomationProperties.Name="{x:Bind Model.DecDisplayValue_AutomationName, Mode=OneWay}"
Checked="DecButtonChecked"
Content="{x:Bind Model.DecimalDisplayValue, Mode=OneWay}"
ContextFlyout="{StaticResource ProgrammerOperatorsContextMenu}"
GroupName="BaseConversion"
IsChecked="true"/>
<controls:RadixButton x:Name="OctButton"
x:Uid="octButton"
Grid.Row="2"
HorizontalAlignment="Stretch"
Style="{ThemeResource ConditionalProgModeRadioButtonStyle}"
AutomationProperties.AutomationId="octolButton"
AutomationProperties.Name="{x:Bind Model.OctDisplayValue_AutomationName, Mode=OneWay}"
Checked="OctButtonChecked"
Content="{x:Bind Model.OctalDisplayValue, Mode=OneWay}"
ContextFlyout="{StaticResource ProgrammerOperatorsContextMenu}"
GroupName="BaseConversion"/>
<controls:RadixButton x:Name="BinaryButton"
x:Uid="binaryButton"
Grid.Row="3"
HorizontalAlignment="Stretch"
Style="{ThemeResource ConditionalProgModeRadioButtonStyle}"
AutomationProperties.AutomationId="binaryButton"
AutomationProperties.Name="{x:Bind Model.BinDisplayValue_AutomationName, Mode=OneWay}"
Checked="BinButtonChecked"
Content="{x:Bind Model.BinaryDisplayValue, Mode=OneWay}"
ContextFlyout="{StaticResource ProgrammerOperatorsContextMenu}"
GroupName="BaseConversion"/>
</Grid>
</UserControl>