Skip to content

Commit

Permalink
fix(button): fix button ignoring ButtonForeground/PointerOver values
Browse files Browse the repository at this point in the history
  • Loading branch information
ramezgerges committed Jul 7, 2023
1 parent 4ffc411 commit 446223c
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 20 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,14 @@
<Button Content="Clear"
Command="{Binding ClearCommand}" />
<ItemsControl ItemsSource="{Binding Output}" x:Name="myItemsControl" />
<Button Content="This button changes color when hovered">
<Button.Resources>
<ResourceDictionary>
<SolidColorBrush x:Key="ButtonForeground" Color="Yellow"/>
<SolidColorBrush x:Key="ButtonForegroundPointerOver" Color="Red"/>
</ResourceDictionary>
</Button.Resources>
</Button>
</StackPanel>
</Grid>
</UserControl>
36 changes: 16 additions & 20 deletions src/Uno.UI/UI/Xaml/Style/Generic/Generic.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -2804,12 +2804,9 @@
<!-- Default style for Windows.UI.Xaml.Controls.Button -->
<Style x:Key="XamlDefaultButton"
TargetType="Button">
<Setter Property="Background"
Value="{ThemeResource SystemControlBackgroundBaseLowBrush}" />
<Setter Property="Foreground"
Value="{ThemeResource SystemControlForegroundBaseHighBrush}" />
<Setter Property="BorderBrush"
Value="{ThemeResource SystemControlForegroundTransparentBrush}" />
<Setter Property="Background" Value="{ThemeResource ButtonBackground}" />
<Setter Property="Foreground" Value="{ThemeResource ButtonForeground}" />
<Setter Property="BorderBrush" Value="{ThemeResource ButtonBorderBrush}" />
<Setter Property="BorderThickness"
Value="{ThemeResource ButtonBorderThemeThickness}" />
<Setter Property="Padding"
Expand Down Expand Up @@ -2840,20 +2837,19 @@
</Storyboard>-->
</VisualState>
<VisualState x:Name="PointerOver">
<Storyboard>
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="ContentPresenter"
Storyboard.TargetProperty="BorderBrush">
<DiscreteObjectKeyFrame KeyTime="0"
Value="{ThemeResource SystemControlHighlightBaseMediumLowBrush}" />
</ObjectAnimationUsingKeyFrames>
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="ContentPresenter"
Storyboard.TargetProperty="Foreground">
<DiscreteObjectKeyFrame KeyTime="0"
Value="{ThemeResource SystemControlHighlightBaseHighBrush}" />
</ObjectAnimationUsingKeyFrames>
<!--<PointerUpThemeAnimation Storyboard.TargetName="RootGrid" />-->
</Storyboard>
</VisualState>
<Storyboard>
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="ContentPresenter" Storyboard.TargetProperty="Background">
<DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource ButtonBackgroundPointerOver}" />
</ObjectAnimationUsingKeyFrames>
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="ContentPresenter" Storyboard.TargetProperty="BorderBrush">
<DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource ButtonBorderBrushPointerOver}" />
</ObjectAnimationUsingKeyFrames>
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="ContentPresenter" Storyboard.TargetProperty="Foreground">
<DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource ButtonForegroundPointerOver}" />
</ObjectAnimationUsingKeyFrames>
<PointerUpThemeAnimation Storyboard.TargetName="ContentPresenter" />
</Storyboard>
</VisualState>
<VisualState x:Name="Pressed">
<Storyboard>
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="RootGrid"
Expand Down

0 comments on commit 446223c

Please sign in to comment.