Skip to content

Commit

Permalink
Fix some controls not using GlyphBrush and use a highlight border for…
Browse files Browse the repository at this point in the history
… mouse over effect.
  • Loading branch information
darklinkpower committed Sep 28, 2024
1 parent bfc34fe commit cacbf46
Show file tree
Hide file tree
Showing 4 changed files with 60 additions and 57 deletions.
29 changes: 12 additions & 17 deletions source/DefaultControls/Button.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
mc:Ignorable="d">

<Style TargetType="{x:Type Button}" BasedOn="{StaticResource BaseStyle}">
<Setter Property="Background" Value="{DynamicResource PurpleButtonBrush}" />
<Setter Property="Background" Value="{DynamicResource GlyphBrush}" />
<Setter Property="Foreground" Value="White" />
<Setter Property="FontWeight" Value="Normal" />
<Setter Property="BorderBrush" Value="{DynamicResource NormalBorderBrush}" />
Expand All @@ -18,32 +18,27 @@
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type Button}">
<Border x:Name="Border" BorderThickness="{TemplateBinding BorderThickness}" Background="{TemplateBinding Background}"
CornerRadius="{DynamicResource ControlCornerRadius}" Style="{DynamicResource HighlightBorder}"
BorderBrush="{TemplateBinding BorderBrush}">
<Grid x:Name="Grid">
<Border x:Name="DefaultBorder" BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}" Background="{TemplateBinding Background}"
Opacity="1" CornerRadius="{DynamicResource ControlCornerRadius}" />
<Border x:Name="HighlightBorder" Background="#40d5c7ec" Visibility="Collapsed"
CornerRadius="{DynamicResource ControlCornerRadius}" />
<ContentPresenter HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
Margin="{TemplateBinding Padding}" RecognizesAccessKey="True" />
</Border>
</Grid>
<ControlTemplate.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter Property="Visibility" Value="Visible" TargetName="HighlightBorder" />
</Trigger>
<Trigger Property="IsFocused" Value="True">
<Setter Property="BorderBrush" Value="{DynamicResource GlyphBrush}" TargetName="Border" />
<Setter Property="Visibility" Value="Visible" TargetName="HighlightBorder" />
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
<Style.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter Property="Background" Value="{DynamicResource PurpleButtonBrushHighlight}" />
<Setter Property="BorderBrush" Value="{DynamicResource GlyphBrush}" />
</Trigger>
<Trigger Property="IsFocused" Value="True">
<Setter Property="Foreground" Value="{DynamicResource TextBrush}" />
<Setter Property="Background" Value="{DynamicResource PurpleButtonBrushHighlight}" />
<Setter Property="BorderBrush" Value="{DynamicResource GlyphBrush}" />
</Trigger>
</Style.Triggers>
</Style>

<Style TargetType="{x:Type Button}" x:Key="PlayersCountButtonStyle">
Expand Down
4 changes: 2 additions & 2 deletions source/DefaultControls/TextBox.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,10 @@
</Border>
<ControlTemplate.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter Property="BorderBrush" Value="{DynamicResource TextBoxBorderBrushHover}" TargetName="Border"/>
<Setter Property="BorderBrush" Value="{DynamicResource NormalBorderBrushControlsHover}" TargetName="Border"/>
</Trigger>
<Trigger Property="IsFocused" Value="True">
<Setter Property="BorderBrush" Value="{DynamicResource TextBoxBorderBrushSelected}" TargetName="Border" />
<Setter Property="BorderBrush" Value="{DynamicResource GlyphBrush}" TargetName="Border" />
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
Expand Down
3 changes: 1 addition & 2 deletions source/DerivedStyles/BottomButton.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,12 @@
<Setter Property="BorderThickness" Value="0" />
<Setter Property="FontWeight" Value="Medium" />
<Setter Property="FontSize" Value="{DynamicResource FontSizeLarge}" />
<Setter Property="Background" Value="{DynamicResource PurpleButtonBrush}" />
<Setter Property="Background" Value="{DynamicResource GlyphBrush}" />
<Setter Property="Foreground" Value="{DynamicResource TextBrush}" />
<Setter Property="Cursor" Value="Hand"/>
<Style.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter Property="Foreground" Value="{DynamicResource TextBrush}" />
<Setter Property="Background" Value="{DynamicResource PurpleButtonBrushHighlight}" />
<Setter Property="BorderBrush" Value="{DynamicResource GlyphBrush}" />
</Trigger>
</Style.Triggers>
Expand Down
81 changes: 45 additions & 36 deletions source/DerivedStyles/PlayButton.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,28 @@
<Grid x:Name="Grid">
<Border x:Name="DefaultBorder" BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}" Background="{TemplateBinding Background}"
Opacity="1" CornerRadius="{DynamicResource ControlCornerRadius}"/>
Opacity="1" CornerRadius="{DynamicResource ControlCornerRadius}" />
<Border x:Name="HighlightBorder" Background="#d5c7ec"
Opacity="0" CornerRadius="{DynamicResource ControlCornerRadius}" />
<ContentPresenter HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" Margin="{TemplateBinding Padding}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}" RecognizesAccessKey="True" />
</Grid>
<ControlTemplate.Triggers>
<Trigger Property="IsEnabled" Value="True" />
<Trigger Property="IsMouseOver" Value="True">
<Trigger.EnterActions>
<BeginStoryboard>
<Storyboard>
<DoubleAnimation Storyboard.TargetName="HighlightBorder" Storyboard.TargetProperty="Opacity" To="0.25" Duration="0:0:0.15" />
</Storyboard>
</BeginStoryboard>
</Trigger.EnterActions>
<Trigger.ExitActions>
<BeginStoryboard>
<Storyboard>
<DoubleAnimation Storyboard.TargetName="HighlightBorder" Storyboard.TargetProperty="Opacity" To="0.0" Duration="0:0:0.15" />
</Storyboard>
</BeginStoryboard>
</Trigger.ExitActions>
</Trigger>
<Trigger Property="IsEnabled" Value="False">
<Setter Property="Background" Value="{DynamicResource DisabledBackgroundBrush}" TargetName="DefaultBorder" />
<Setter Property="Opacity" TargetName="Grid" Value="0.5" />
Expand All @@ -27,17 +44,10 @@
</ControlTemplate>
</Setter.Value>
</Setter>
<Style.Triggers>
<Trigger Property="IsMouseOver" Value="true">
<Setter Property="Background" Value="{DynamicResource PurpleButtonBrushHighlight}" />
<Setter Property="Foreground" Value="{DynamicResource TextBrush}" />
<Setter Property="BorderBrush" Value="{DynamicResource TextBrush}" />
</Trigger>
</Style.Triggers>
</Style>

<Style x:Key="PlayButtonViews" TargetType="{x:Type Button}">
<Setter Property="Background" Value="#a17fd0" />
<Setter Property="Background" Value="{DynamicResource GlyphBrush}" />
<Setter Property="Foreground" Value="White" />
<Setter Property="BorderBrush" Value="{DynamicResource NormalBorderBrush}" />
<Setter Property="BorderThickness" Value="0" />
Expand All @@ -51,43 +61,42 @@
<Grid x:Name="Grid">
<Border x:Name="DefaultBorder" BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}" Background="{TemplateBinding Background}"
Opacity="1" CornerRadius="{DynamicResource ControlCornerRadiusViewPlayButtons}">
<StackPanel Orientation="Horizontal" HorizontalAlignment="Center" VerticalAlignment="Center">
<Viewbox Margin="0,0,5,0" Height="18">
<Path Stroke="{TemplateBinding Foreground}" StrokeThickness="1"
Opacity="1" CornerRadius="{DynamicResource ControlCornerRadiusViewPlayButtons}" />
<Border x:Name="HighlightBorder" Background="#d5c7ec"
Opacity="0" CornerRadius="{DynamicResource ControlCornerRadiusViewPlayButtons}" />
<StackPanel Orientation="Horizontal" HorizontalAlignment="Center" VerticalAlignment="Center">
<Viewbox Margin="0,0,5,0" Height="18">
<Path Stroke="{TemplateBinding Foreground}" StrokeThickness="1"
VerticalAlignment="Center" HorizontalAlignment="Center"
Data="F1 M 2.38 10.44 C 2.38 9.96 2.366666 9.233334 2.34 8.259999 C 2.326666 7.153333 2.32 6.326666 2.32 5.78 C 2.32 4.860001 2.353333 4.04 2.42 3.32 C 2.486666 2.466667 2.71 1.806667 3.09 1.34 C 3.47 0.873333 3.963333 0.639999 4.57 0.639999 C 5.176666 0.639999 5.84 0.886665 6.56 1.379999 C 9.173332 3.153334 12.446666 5.540001 16.379999 8.54 C 17.246666 9.193333 17.676666 9.889999 17.67 10.629999 C 17.663334 11.37 17.219999 12.066666 16.34 12.719999 C 14.286666 14.266666 12.619999 15.506666 11.34 16.439999 C 9.5 17.786667 7.806666 18.993332 6.26 20.059999 C 5.659999 20.473331 5.079999 20.666666 4.52 20.639999 C 3.96 20.613333 3.496666 20.383333 3.13 19.949999 C 2.763333 19.516666 2.546667 18.916666 2.48 18.15 C 2.413333 17.383333 2.38 16.506666 2.38 15.52 C 2.366666 14.92 2.373333 14.026667 2.4 12.84 C 2.426667 11.773334 2.44 10.973333 2.44 10.44 Z" />
</Viewbox>
<ContentPresenter HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" Margin="{TemplateBinding Padding}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}" RecognizesAccessKey="True" />
</StackPanel>
</Border>
</Viewbox>
<ContentPresenter HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" Margin="{TemplateBinding Padding}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}" RecognizesAccessKey="True" />
</StackPanel>
</Grid>
<ControlTemplate.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Trigger.EnterActions>
<BeginStoryboard>
<Storyboard>
<DoubleAnimation Storyboard.TargetName="HighlightBorder" Storyboard.TargetProperty="Opacity" To="0.25" Duration="0:0:0.15" />
</Storyboard>
</BeginStoryboard>
</Trigger.EnterActions>
<Trigger.ExitActions>
<BeginStoryboard>
<Storyboard>
<DoubleAnimation Storyboard.TargetName="HighlightBorder" Storyboard.TargetProperty="Opacity" To="0.0" Duration="0:0:0.15" />
</Storyboard>
</BeginStoryboard>
</Trigger.ExitActions>
</Trigger>
<Trigger Property="IsEnabled" Value="False">
<Setter Property="Opacity" TargetName="Grid" Value="0.5" />
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
<Style.Triggers>
<Trigger Property="IsMouseOver" Value="true">
<Trigger.EnterActions>
<BeginStoryboard>
<Storyboard TargetProperty="(Background).(SolidColorBrush.Color)">
<ColorAnimation To="#ae91d7" Duration="0:0:0.2" FillBehavior="HoldEnd"/>
</Storyboard>
</BeginStoryboard>
</Trigger.EnterActions>
<Trigger.ExitActions>
<BeginStoryboard>
<Storyboard TargetProperty="(Background).(SolidColorBrush.Color)">
<ColorAnimation To="#a17fd0" Duration="0:0:0.2" FillBehavior="HoldEnd"/>
</Storyboard>
</BeginStoryboard>
</Trigger.ExitActions>
</Trigger>
</Style.Triggers>
</Style>

<Style x:Key="ContextButtonViews" TargetType="{x:Type Button}">
Expand Down

0 comments on commit cacbf46

Please sign in to comment.