Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix: No contrast of the CopyButton in the color guidance page #1554

Merged
merged 7 commits into from
Jun 19, 2024
Merged
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
60 changes: 30 additions & 30 deletions WinUIGallery/Controls/CopyButton/CopyButton.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
<Style x:Key="DefaultCopyButtonStyle" TargetType="local:CopyButton">
<Setter Property="Background" Value="{ThemeResource ButtonBackground}" />
<Setter Property="BackgroundSizing" Value="InnerBorderEdge" />
<Setter Property="Foreground" Value="{ThemeResource ButtonForeground}" />
<Setter Property="Foreground" Value="{x:Null}" />
<Setter Property="BorderBrush" Value="{ThemeResource ButtonBorderBrush}" />
<Setter Property="BorderThickness" Value="{ThemeResource ButtonBorderThemeThickness}" />
<Setter Property="Padding" Value="6" />
Expand Down Expand Up @@ -129,31 +129,6 @@
<BrushTransition Duration="0:0:0.083" />
</Grid.BackgroundTransition>

<ContentPresenter
x:Name="ContentPresenter"
HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}"
VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}"
Content="{TemplateBinding Content}"
ContentTemplate="{TemplateBinding ContentTemplate}"
ContentTransitions="{TemplateBinding ContentTransitions}"
FontFamily="{TemplateBinding FontFamily}"
FontSize="{TemplateBinding FontSize}"
Foreground="{TemplateBinding Foreground}"
RenderTransformOrigin=".5,.5">
<ContentPresenter.RenderTransform>
<ScaleTransform x:Name="CopyToClipboardTextScaleTransform" />
</ContentPresenter.RenderTransform>
</ContentPresenter>
<ContentPresenter
x:Name="CopySuccessGlyph"
Foreground="{TemplateBinding Foreground}"
Opacity="0"
RenderTransformOrigin=".5,.5">
<ContentPresenter.RenderTransform>
<ScaleTransform x:Name="CopyToClipboardSuccessTextScaleTransform" />
</ContentPresenter.RenderTransform>
<FontIcon FontSize="{TemplateBinding FontSize}" Glyph="&#xE73E;" />
</ContentPresenter>
<VisualStateManager.VisualStateGroups>
<VisualStateGroup x:Name="CommonStates">
<VisualState x:Name="Normal" />
Expand All @@ -166,10 +141,10 @@
<DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource ButtonBorderBrushPointerOver}" />
</ObjectAnimationUsingKeyFrames>
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="ContentPresenter" Storyboard.TargetProperty="Foreground">
<DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource ButtonForegroundPointerOver}" />
<DiscreteObjectKeyFrame KeyTime="0" Value="{Binding Foreground, RelativeSource={RelativeSource Mode=TemplatedParent}, TargetNullValue={ThemeResource ButtonForegroundPointerOver}}" />
</ObjectAnimationUsingKeyFrames>
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="CopySuccessGlyph" Storyboard.TargetProperty="Foreground">
<DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource ButtonForegroundPointerOver}" />
<DiscreteObjectKeyFrame KeyTime="0" Value="{Binding Foreground, RelativeSource={RelativeSource Mode=TemplatedParent}, TargetNullValue={ThemeResource ButtonForegroundPointerOver}}" />
</ObjectAnimationUsingKeyFrames>
</Storyboard>
<VisualState.Setters>
Expand All @@ -186,10 +161,10 @@
<DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource ButtonBorderBrushPressed}" />
</ObjectAnimationUsingKeyFrames>
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="ContentPresenter" Storyboard.TargetProperty="Foreground">
<DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource ButtonForegroundPressed}" />
<DiscreteObjectKeyFrame KeyTime="0" Value="{Binding Foreground, RelativeSource={RelativeSource Mode=TemplatedParent}, TargetNullValue={ThemeResource ButtonForegroundPressed}}" />
</ObjectAnimationUsingKeyFrames>
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="CopySuccessGlyph" Storyboard.TargetProperty="Foreground">
<DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource ButtonForegroundPressed}" />
<DiscreteObjectKeyFrame KeyTime="0" Value="{Binding Foreground, RelativeSource={RelativeSource Mode=TemplatedParent}, TargetNullValue={ThemeResource ButtonForegroundPressed}}" />
</ObjectAnimationUsingKeyFrames>
</Storyboard>
<VisualState.Setters>
Expand Down Expand Up @@ -219,6 +194,31 @@
</VisualState>
</VisualStateGroup>
</VisualStateManager.VisualStateGroups>
<ContentPresenter
x:Name="ContentPresenter"
HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}"
VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}"
Content="{TemplateBinding Content}"
ContentTemplate="{TemplateBinding ContentTemplate}"
ContentTransitions="{TemplateBinding ContentTransitions}"
FontFamily="{TemplateBinding FontFamily}"
FontSize="{TemplateBinding FontSize}"
Foreground="{Binding Foreground, RelativeSource={RelativeSource Mode=TemplatedParent}, TargetNullValue={ThemeResource ButtonForeground}}"
RenderTransformOrigin=".5,.5">
<ContentPresenter.RenderTransform>
<ScaleTransform x:Name="CopyToClipboardTextScaleTransform" />
</ContentPresenter.RenderTransform>
</ContentPresenter>
<ContentPresenter
x:Name="CopySuccessGlyph"
Foreground="{Binding Foreground, RelativeSource={RelativeSource Mode=TemplatedParent}, TargetNullValue={ThemeResource ButtonForeground}}"
Opacity="0"
RenderTransformOrigin=".5,.5">
<ContentPresenter.RenderTransform>
<ScaleTransform x:Name="CopyToClipboardSuccessTextScaleTransform" />
</ContentPresenter.RenderTransform>
<FontIcon FontSize="{TemplateBinding FontSize}" Glyph="&#xE73E;" />
</ContentPresenter>
</Grid>
</ControlTemplate>
</Setter.Value>
Expand Down