Add OverlayButtonStyle

This commit is contained in:
Yoshi Askharoun
2024-05-13 00:38:38 -05:00
parent 740d41cb2b
commit 29a265c52e
2 changed files with 71 additions and 3 deletions
+10 -1
View File
@@ -8,7 +8,7 @@
d:DesignHeight="450" d:DesignWidth="800">
<StackPanel HorizontalAlignment="Left">
<Border Padding="8">
<Button Content="About ZMH" Style="{StaticResource ActionButtonStyle}"
<Button Content="About Zune" Style="{StaticResource ActionButtonStyle}"
VerticalAlignment="Center" HorizontalAlignment="Center"/>
</Border>
@@ -16,5 +16,14 @@
<Button Content="Buy" Style="{StaticResource ActionButtonPinkStyle}"
VerticalAlignment="Center" HorizontalAlignment="Center"/>
</Border>
<Border Padding="8" Background="DarkGray">
<Button VerticalAlignment="Center" HorizontalAlignment="Center"
Style="{StaticResource OverlayButtonStyle}">
<Viewbox Width="12" Height="12">
<Path Fill="White" Data="F1 M 18.574219 1.914062 L 19.755859 3.085938 L 6.669922 16.181641 L 0.244141 9.755859 L 1.425781 8.574219 L 6.669922 13.818359 Z"/>
</Viewbox>
</Button>
</Border>
</StackPanel>
</UserControl>
+61 -2
View File
@@ -1,5 +1,6 @@
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:zmhc="clr-namespace:ZuneModdingHelper.Controls">
<Style x:Key="ActionButtonStyle" TargetType="Button">
<Style.Resources>
@@ -161,5 +162,63 @@
</Setter.Value>
</Setter>
</Style>
<Style x:Key="OverlayButtonStyle" TargetType="Button">
<Setter Property="Background" Value="#4D000000"/>
<Setter Property="BorderBrush" Value="Transparent"/>
<Setter Property="BorderThickness" Value="0"/>
<Setter Property="HorizontalContentAlignment" Value="Center"/>
<Setter Property="VerticalContentAlignment" Value="Center"/>
<Setter Property="Width" Value="32"/>
<Setter Property="Height" Value="32"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="Button">
<Border BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}">
<Grid>
<Path x:Name="ForeCircle" Stroke="#CCFFFFFF" StrokeThickness="1" Fill="#4D000000"
HorizontalAlignment="Center" VerticalAlignment="Center">
<Path.Data>
<EllipseGeometry RadiusX="12" RadiusY="12" Center="12,12"/>
</Path.Data>
</Path>
<ContentPresenter
Margin="{TemplateBinding Padding}"
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
VerticalAlignment="{TemplateBinding VerticalContentAlignment}"/>
</Grid>
<VisualStateManager.VisualStateGroups>
<VisualStateGroup x:Name="CommonStates">
<VisualState x:Name="Normal" />
<VisualState x:Name="MouseOver">
<Storyboard>
<ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Effect" Storyboard.TargetName="ForeCircle">
<DiscreteObjectKeyFrame KeyTime="0">
<DiscreteObjectKeyFrame.Value>
<DropShadowEffect Direction="0" ShadowDepth="0" Color="White" BlurRadius="2" Opacity="0.5"/>
</DiscreteObjectKeyFrame.Value>
</DiscreteObjectKeyFrame>
</ObjectAnimationUsingKeyFrames>
</Storyboard>
</VisualState>
<VisualState x:Name="Pressed">
<Storyboard>
<ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Effect" Storyboard.TargetName="ForeCircle">
<DiscreteObjectKeyFrame KeyTime="0">
<DiscreteObjectKeyFrame.Value>
<DropShadowEffect Direction="0" ShadowDepth="0" Color="White" BlurRadius="4" Opacity="1.0"/>
</DiscreteObjectKeyFrame.Value>
</DiscreteObjectKeyFrame>
</ObjectAnimationUsingKeyFrames>
</Storyboard>
</VisualState>
</VisualStateGroup>
</VisualStateManager.VisualStateGroups>
</Border>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</ResourceDictionary>