|
6 | 6 | xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" |
7 | 7 | xmlns:local="using:WinUIGallery.Controls"> |
8 | 8 |
|
| 9 | + <ResourceDictionary.ThemeDictionaries> |
| 10 | + <ResourceDictionary x:Key="Dark"> |
| 11 | + <StaticResource x:Key="CopyButtonPointerOverForegroundBrush" ResourceKey="ButtonForegroundPointerOver" /> |
| 12 | + <StaticResource x:Key="CopyButtonPressedForegroundBrush" ResourceKey="ButtonForegroundPressed" /> |
| 13 | + </ResourceDictionary> |
| 14 | + <ResourceDictionary x:Key="Light"> |
| 15 | + <StaticResource x:Key="CopyButtonPointerOverForegroundBrush" ResourceKey="ButtonForegroundPointerOver" /> |
| 16 | + <StaticResource x:Key="CopyButtonPressedForegroundBrush" ResourceKey="ButtonForegroundPressed" /> |
| 17 | + </ResourceDictionary> |
| 18 | + <ResourceDictionary x:Key="HighContrast"> |
| 19 | + <StaticResource x:Key="CopyButtonPointerOverForegroundBrush" ResourceKey="ButtonForegroundPointerOver" /> |
| 20 | + <StaticResource x:Key="CopyButtonPressedForegroundBrush" ResourceKey="ButtonForegroundPressed" /> |
| 21 | + </ResourceDictionary> |
| 22 | + </ResourceDictionary.ThemeDictionaries> |
| 23 | + |
9 | 24 | <Style BasedOn="{StaticResource DefaultCopyButtonStyle}" TargetType="local:CopyButton" /> |
10 | 25 |
|
11 | 26 | <Style x:Key="DefaultCopyButtonStyle" TargetType="local:CopyButton"> |
12 | 27 | <Setter Property="Background" Value="{ThemeResource ButtonBackground}" /> |
13 | 28 | <Setter Property="BackgroundSizing" Value="InnerBorderEdge" /> |
14 | | - <Setter Property="Foreground" Value="{x:Null}" /> |
| 29 | + <Setter Property="Foreground" Value="{ThemeResource ButtonForeground}" /> |
15 | 30 | <Setter Property="BorderBrush" Value="{ThemeResource ButtonBorderBrush}" /> |
16 | 31 | <Setter Property="BorderThickness" Value="{ThemeResource ButtonBorderThemeThickness}" /> |
17 | 32 | <Setter Property="Padding" Value="6" /> |
|
138 | 153 | ContentTransitions="{TemplateBinding ContentTransitions}" |
139 | 154 | FontFamily="{TemplateBinding FontFamily}" |
140 | 155 | FontSize="{TemplateBinding FontSize}" |
141 | | - Foreground="{Binding Foreground, RelativeSource={RelativeSource Mode=TemplatedParent}, TargetNullValue={ThemeResource ButtonForeground}}" |
| 156 | + Foreground="{TemplateBinding Foreground}" |
142 | 157 | RenderTransformOrigin=".5,.5"> |
143 | 158 | <ContentPresenter.RenderTransform> |
144 | 159 | <ScaleTransform x:Name="CopyToClipboardTextScaleTransform" /> |
145 | 160 | </ContentPresenter.RenderTransform> |
146 | 161 | </ContentPresenter> |
147 | 162 | <ContentPresenter |
148 | 163 | x:Name="CopySuccessGlyph" |
149 | | - Foreground="{Binding Foreground, RelativeSource={RelativeSource Mode=TemplatedParent}, TargetNullValue={ThemeResource ButtonForeground}}" |
| 164 | + Foreground="{TemplateBinding Foreground}" |
150 | 165 | Opacity="0" |
151 | 166 | RenderTransformOrigin=".5,.5"> |
152 | 167 | <ContentPresenter.RenderTransform> |
|
167 | 182 | <DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource ButtonBorderBrushPointerOver}" /> |
168 | 183 | </ObjectAnimationUsingKeyFrames> |
169 | 184 | <ObjectAnimationUsingKeyFrames Storyboard.TargetName="ContentPresenter" Storyboard.TargetProperty="Foreground"> |
170 | | - <DiscreteObjectKeyFrame KeyTime="0" Value="{Binding Foreground, RelativeSource={RelativeSource Mode=TemplatedParent}, TargetNullValue={ThemeResource ButtonForegroundPointerOver}}" /> |
| 185 | + <DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource CopyButtonPointerOverForegroundBrush}" /> |
171 | 186 | </ObjectAnimationUsingKeyFrames> |
172 | 187 | <ObjectAnimationUsingKeyFrames Storyboard.TargetName="CopySuccessGlyph" Storyboard.TargetProperty="Foreground"> |
173 | | - <DiscreteObjectKeyFrame KeyTime="0" Value="{Binding Foreground, RelativeSource={RelativeSource Mode=TemplatedParent}, TargetNullValue={ThemeResource ButtonForegroundPointerOver}}" /> |
| 188 | + <DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource CopyButtonPointerOverForegroundBrush}" /> |
174 | 189 | </ObjectAnimationUsingKeyFrames> |
175 | 190 | </Storyboard> |
176 | 191 | <VisualState.Setters> |
|
187 | 202 | <DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource ButtonBorderBrushPressed}" /> |
188 | 203 | </ObjectAnimationUsingKeyFrames> |
189 | 204 | <ObjectAnimationUsingKeyFrames Storyboard.TargetName="ContentPresenter" Storyboard.TargetProperty="Foreground"> |
190 | | - <DiscreteObjectKeyFrame KeyTime="0" Value="{Binding Foreground, RelativeSource={RelativeSource Mode=TemplatedParent}, TargetNullValue={ThemeResource ButtonForegroundPressed}}" /> |
| 205 | + <DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource CopyButtonPressedForegroundBrush}" /> |
191 | 206 | </ObjectAnimationUsingKeyFrames> |
192 | 207 | <ObjectAnimationUsingKeyFrames Storyboard.TargetName="CopySuccessGlyph" Storyboard.TargetProperty="Foreground"> |
193 | | - <DiscreteObjectKeyFrame KeyTime="0" Value="{Binding Foreground, RelativeSource={RelativeSource Mode=TemplatedParent}, TargetNullValue={ThemeResource ButtonForegroundPressed}}" /> |
| 208 | + <DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource CopyButtonPressedForegroundBrush}" /> |
194 | 209 | </ObjectAnimationUsingKeyFrames> |
195 | 210 | </Storyboard> |
196 | 211 | <VisualState.Setters> |
|
0 commit comments