1
0
mirror of https://github.com/DarthAffe/RGBSyncPlus synced 2025-12-13 09:28:31 +00:00
RGBSyncPlus/RGBSync+/Styles/ImageButton.xaml

119 lines
5.7 KiB
XML

<styles:CachedResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:buttons="clr-namespace:RGBSyncPlus.Controls"
xmlns:styles="clr-namespace:RGBSyncPlus.Styles">
<styles:CachedResourceDictionary.MergedDictionaries>
<styles:CachedResourceDictionary Source="/RGBSync+;component/Styles/FrameworkElement.xaml" />
</styles:CachedResourceDictionary.MergedDictionaries>
<Style x:Key="StyleImageButton"
BasedOn="{StaticResource StyleFrameworkElement}"
TargetType="{x:Type buttons:ImageButton}">
<Setter Property="Padding" Value="0" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type buttons:ImageButton}">
<Grid Background="Transparent">
<Image x:Name="ImageNormal" Margin="{TemplateBinding Padding}"
Source="{TemplateBinding Image}" Stretch="Uniform" />
<Image x:Name="ImageHover" Margin="{TemplateBinding Padding}"
Opacity="0"
Source="{TemplateBinding HoverImage}" Stretch="Uniform" />
<Image x:Name="ImagePressed" Margin="{TemplateBinding Padding}"
Opacity="0"
Source="{TemplateBinding PressedImage}" Stretch="Uniform" />
</Grid>
<ControlTemplate.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Trigger.EnterActions>
<BeginStoryboard>
<Storyboard TargetName="ImageHover">
<DoubleAnimation Storyboard.TargetProperty="Opacity" To="1.0" Duration="0:0:0.150" />
</Storyboard>
</BeginStoryboard>
</Trigger.EnterActions>
<Trigger.ExitActions>
<BeginStoryboard>
<Storyboard TargetName="ImageHover">
<DoubleAnimation Storyboard.TargetProperty="Opacity" To="0" Duration="0:0:0.250" />
</Storyboard>
</BeginStoryboard>
</Trigger.ExitActions>
</Trigger>
<Trigger Property="IsPressed" Value="True">
<Trigger.EnterActions>
<BeginStoryboard>
<Storyboard TargetName="ImagePressed">
<DoubleAnimation Storyboard.TargetProperty="Opacity" To="1.0" Duration="0:0:0.150" />
</Storyboard>
</BeginStoryboard>
</Trigger.EnterActions>
<Trigger.ExitActions>
<BeginStoryboard>
<Storyboard TargetName="ImagePressed">
<DoubleAnimation Storyboard.TargetProperty="Opacity" To="0" Duration="0:0:0.250" />
</Storyboard>
</BeginStoryboard>
</Trigger.ExitActions>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<Style x:Key="StyleImageButtonWithOpacity"
BasedOn="{StaticResource StyleFrameworkElement}"
TargetType="{x:Type buttons:ImageButton}">
<Setter Property="Opacity" Value="0.66" />
<Setter Property="Padding" Value="0" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type buttons:ImageButton}">
<Grid Background="Transparent">
<Image x:Name="ImageNormal" Margin="{TemplateBinding Padding}"
Source="{TemplateBinding Image}" Stretch="Uniform" />
</Grid>
</ControlTemplate>
</Setter.Value>
</Setter>
<Style.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Trigger.EnterActions>
<BeginStoryboard>
<Storyboard>
<DoubleAnimation Storyboard.TargetProperty="Opacity" To="1.0" Duration="0:0:0.150" />
</Storyboard>
</BeginStoryboard>
</Trigger.EnterActions>
<Trigger.ExitActions>
<BeginStoryboard>
<Storyboard>
<DoubleAnimation Storyboard.TargetProperty="Opacity" Duration="0:0:0.250" />
</Storyboard>
</BeginStoryboard>
</Trigger.ExitActions>
</Trigger>
</Style.Triggers>
</Style>
<Style x:Key="StyleImageButtonMenu"
BasedOn="{StaticResource StyleImageButton}"
TargetType="{x:Type buttons:ImageButton}">
<Setter Property="Width" Value="180" />
<Setter Property="Height" Value="90" />
<Setter Property="Margin" Value="0,16" />
<Setter Property="HorizontalAlignment" Value="Center" />
</Style>
</styles:CachedResourceDictionary>