|
10 | 10 | Loaded="CalculatorPage_Loaded"> |
11 | 11 | <Page.Resources> |
12 | 12 | <Style TargetType="Button" x:Key="CalculatorButtonStyle"> |
13 | | - <Setter Property="Background" Value="{ThemeResource ButtonBackground}" /> |
14 | | - <Setter Property="Foreground" Value="{ThemeResource ButtonForeground}" /> |
15 | | - <Setter Property="BorderBrush" Value="{ThemeResource ButtonBorderBrush}" /> |
16 | | - <Setter Property="BorderThickness" Value="1" /> |
| 13 | + <Setter Property="Background" Value="{ThemeResource ButtonBackground}"/> |
| 14 | + <Setter Property="Foreground" Value="{ThemeResource ButtonForeground}"/> |
| 15 | + <Setter Property="BorderThickness" Value="1"/> |
17 | 16 | <Setter Property="Padding" Value="2"/> |
18 | 17 | <Setter Property="Margin" Value="5"/> |
19 | 18 | <Setter Property="CornerRadius" Value="7"/> |
20 | | - <Setter Property="FontWeight" Value="Normal" /> |
21 | | - <Setter Property="FontSize" Value="20" /> |
22 | | - <Setter Property="HorizontalContentAlignment" Value="Center" /> |
| 19 | + <Setter Property="FontWeight" Value="Normal"/> |
| 20 | + <Setter Property="FontSize" Value="20"/> |
| 21 | + <Setter Property="HorizontalContentAlignment" Value="Center"/> |
23 | 22 | <Setter Property="HorizontalAlignment" Value="Stretch"/> |
24 | | - <Setter Property="VerticalContentAlignment" Value="Center" /> |
| 23 | + <Setter Property="VerticalContentAlignment" Value="Center"/> |
25 | 24 | <Setter Property="VerticalAlignment" Value="Stretch"/> |
26 | | - <Setter Property="MinWidth" Value="55" /> |
| 25 | + <Setter Property="MinWidth" Value="55"/> |
27 | 26 | <Setter Property="MinHeight" Value="40"/> |
28 | 27 | <Setter Property="Template"> |
29 | 28 | <Setter.Value> |
30 | 29 | <ControlTemplate TargetType="Button"> |
31 | | - <Grid> |
| 30 | + <Border x:Name="OuterBorder" Background="Transparent"> |
| 31 | + <VisualStateManager.VisualStateGroups> |
| 32 | + <VisualStateGroup x:Name="CommonStates"> |
| 33 | + <VisualState x:Name="Normal"/> |
| 34 | + <VisualState x:Name="PointerOver"> |
| 35 | + <Storyboard> |
| 36 | + <ColorAnimation Duration="0" |
| 37 | + Storyboard.TargetName="Border" |
| 38 | + Storyboard.TargetProperty="(Border.Background).(SolidColorBrush.Color)" |
| 39 | + To="#05AAAAAA"/> |
| 40 | + </Storyboard> |
| 41 | + </VisualState> |
| 42 | + <VisualState x:Name="Pressed"> |
| 43 | + <Storyboard> |
| 44 | + <ColorAnimation Duration="0" |
| 45 | + Storyboard.TargetName="Border" |
| 46 | + Storyboard.TargetProperty="(Border.Background).(SolidColorBrush.Color)" |
| 47 | + To="#07888888"/> |
| 48 | + <DoubleAnimation Duration="0:0:0.1" |
| 49 | + Storyboard.TargetName="ScaleTransform" |
| 50 | + Storyboard.TargetProperty="ScaleX"/> |
| 51 | + <DoubleAnimation Duration="0:0:0.1" |
| 52 | + Storyboard.TargetName="ScaleTransform" |
| 53 | + Storyboard.TargetProperty="ScaleY"/> |
| 54 | + </Storyboard> |
| 55 | + </VisualState> |
| 56 | + </VisualStateGroup> |
| 57 | + </VisualStateManager.VisualStateGroups> |
32 | 58 | <Border x:Name="Border" |
33 | | - Background="{TemplateBinding Background}" |
34 | | - BorderBrush="{TemplateBinding BorderBrush}" |
35 | | - BorderThickness="1" |
36 | | - CornerRadius="{TemplateBinding CornerRadius}"> |
37 | | - <VisualStateManager.VisualStateGroups> |
38 | | - <VisualStateGroup x:Name="CommonStates"> |
39 | | - <VisualState x:Name="Normal"/> |
40 | | - <VisualState x:Name="PointerOver"> |
41 | | - <Storyboard> |
42 | | - <ColorAnimation Storyboard.TargetName="Border" Storyboard.TargetProperty="(Border.Background).(SolidColorBrush.Color)" To="DarkSlateGray" Duration="0:0:0.2"/> |
43 | | - </Storyboard> |
44 | | - </VisualState> |
45 | | - <VisualState x:Name="Pressed"> |
46 | | - <Storyboard> |
47 | | - <ColorAnimation Storyboard.TargetName="Border" Storyboard.TargetProperty="(Border.Background).(SolidColorBrush.Color)" To="DimGray" Duration="0:0:0.2"/> |
48 | | - </Storyboard> |
49 | | - </VisualState> |
50 | | - </VisualStateGroup> |
51 | | - </VisualStateManager.VisualStateGroups> |
| 59 | + Background="{TemplateBinding Background}" |
| 60 | + BorderBrush="{TemplateBinding BorderBrush}" |
| 61 | + BorderThickness="{TemplateBinding BorderThickness}" |
| 62 | + CornerRadius="{TemplateBinding CornerRadius}"> |
52 | 63 | <Border.RenderTransform> |
53 | 64 | <ScaleTransform x:Name="ScaleTransform" ScaleX="1" ScaleY="1"/> |
54 | 65 | </Border.RenderTransform> |
| 66 | + <ContentPresenter x:Name="ContentPresenter" |
| 67 | + ContentTemplate="{TemplateBinding ContentTemplate}" |
| 68 | + Content="{TemplateBinding Content}" |
| 69 | + HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" |
| 70 | + VerticalAlignment="{TemplateBinding VerticalContentAlignment}" |
| 71 | + Margin="{TemplateBinding Padding}"/> |
55 | 72 | </Border> |
56 | | - <ContentPresenter x:Name="ContentPresenter" |
57 | | - ContentTemplate="{TemplateBinding ContentTemplate}" |
58 | | - Content="{TemplateBinding Content}" |
59 | | - ContentTransitions="{TemplateBinding ContentTransitions}" |
60 | | - HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" |
61 | | - VerticalAlignment="{TemplateBinding VerticalContentAlignment}" |
62 | | - Margin="{TemplateBinding Padding}"/> |
63 | | - </Grid> |
| 73 | + </Border> |
64 | 74 | </ControlTemplate> |
65 | 75 | </Setter.Value> |
66 | 76 | </Setter> |
67 | 77 | </Style> |
| 78 | + |
68 | 79 | <Style TargetType="Button" x:Key="NumberButtonStyle" BasedOn="{StaticResource CalculatorButtonStyle}"> |
| 80 | + <Setter Property="Background" Value="{ThemeResource ButtonBackground}"/> |
69 | 81 | <Setter Property="BorderThickness" Value="1"/> |
70 | 82 | <Setter Property="FontWeight" Value="Normal"/> |
71 | 83 | <Setter Property="FontSize" Value="20"/> |
72 | 84 | <Setter Property="CornerRadius" Value="7"/> |
73 | 85 | </Style> |
| 86 | + |
74 | 87 | <Style TargetType="Button" x:Key="AccentButtonStyle" BasedOn="{StaticResource CalculatorButtonStyle}"> |
| 88 | + <Setter Property="Background" Value="{ThemeResource AccentButtonBackground}"/> |
| 89 | + <Setter Property="Foreground" Value="{ThemeResource AccentButtonForeground}"/> |
75 | 90 | <Setter Property="BorderThickness" Value="1"/> |
76 | 91 | <Setter Property="FontWeight" Value="Normal"/> |
77 | 92 | <Setter Property="CornerRadius" Value="7"/> |
78 | 93 | <Setter Property="FontSize" Value="20"/> |
79 | 94 | <Setter Property="Template"> |
80 | 95 | <Setter.Value> |
81 | 96 | <ControlTemplate TargetType="Button"> |
82 | | - <Grid> |
| 97 | + <Border x:Name="OuterBorder" Background="Transparent"> |
| 98 | + <VisualStateManager.VisualStateGroups> |
| 99 | + <VisualStateGroup x:Name="CommonStates"> |
| 100 | + <VisualState x:Name="Normal"/> |
| 101 | + <VisualState x:Name="PointerOver"> |
| 102 | + <Storyboard> |
| 103 | + <ObjectAnimationUsingKeyFrames Storyboard.TargetName="Border" Storyboard.TargetProperty="Background"> |
| 104 | + <DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource AccentButtonHoverBackground}"/> |
| 105 | + </ObjectAnimationUsingKeyFrames> |
| 106 | + </Storyboard> |
| 107 | + </VisualState> |
| 108 | + <VisualState x:Name="Pressed"> |
| 109 | + <Storyboard> |
| 110 | + <ObjectAnimationUsingKeyFrames Storyboard.TargetName="Border" Storyboard.TargetProperty="Background"> |
| 111 | + <DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource AccentButtonPressedBackground}"/> |
| 112 | + </ObjectAnimationUsingKeyFrames> |
| 113 | + </Storyboard> |
| 114 | + </VisualState> |
| 115 | + </VisualStateGroup> |
| 116 | + </VisualStateManager.VisualStateGroups> |
83 | 117 | <Border x:Name="Border" |
84 | | - Background="{TemplateBinding Background}" |
85 | | - CornerRadius="{TemplateBinding CornerRadius}" |
86 | | - BorderThickness="{TemplateBinding BorderThickness}"> |
87 | | - <VisualStateManager.VisualStateGroups> |
88 | | - <VisualStateGroup x:Name="CommonStates"> |
89 | | - <VisualState x:Name="Normal"/> |
90 | | - <VisualState x:Name="PointerOver"> |
91 | | - <Storyboard> |
92 | | - <ColorAnimation Storyboard.TargetName="Border" Storyboard.TargetProperty="(Border.Background).(SolidColorBrush.Color)" To="DarkSlateGray" Duration="0:0:0.2"/> |
93 | | - </Storyboard> |
94 | | - </VisualState> |
95 | | - <VisualState x:Name="Pressed"> |
96 | | - <Storyboard> |
97 | | - <ColorAnimation Storyboard.TargetName="Border" Storyboard.TargetProperty="(Border.Background).(SolidColorBrush.Color)" To="DimGray" Duration="0:0:0.2"/> |
98 | | - </Storyboard> |
99 | | - </VisualState> |
100 | | - </VisualStateGroup> |
101 | | - </VisualStateManager.VisualStateGroups> |
102 | | - <Border.RenderTransform> |
103 | | - <ScaleTransform x:Name="ScaleTransform" ScaleX="1" ScaleY="1"/> |
104 | | - </Border.RenderTransform> |
105 | | - <ContentPresenter HorizontalAlignment="Center" VerticalAlignment="Center"/> |
| 118 | + Background="{TemplateBinding Background}" |
| 119 | + BorderBrush="{TemplateBinding BorderBrush}" |
| 120 | + BorderThickness="{TemplateBinding BorderThickness}" |
| 121 | + CornerRadius="{TemplateBinding CornerRadius}"> |
| 122 | + <ContentPresenter x:Name="ContentPresenter" |
| 123 | + ContentTemplate="{TemplateBinding ContentTemplate}" |
| 124 | + Content="{TemplateBinding Content}" |
| 125 | + HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" |
| 126 | + VerticalAlignment="{TemplateBinding VerticalContentAlignment}" |
| 127 | + Margin="{TemplateBinding Padding}"/> |
106 | 128 | </Border> |
107 | | - </Grid> |
| 129 | + </Border> |
108 | 130 | </ControlTemplate> |
109 | 131 | </Setter.Value> |
110 | 132 | </Setter> |
111 | | - <Setter Property="Background" Value="{ThemeResource AccentButtonBackground}"/> |
112 | | - <Setter Property="Foreground" Value="{ThemeResource AccentButtonForeground}"/> |
113 | 133 | </Style> |
114 | 134 | </Page.Resources> |
115 | 135 | <Grid x:Name="ContentGrid" Background="Transparent" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" RenderTransformOrigin="0.5,0.5"> |
|
0 commit comments