Filtration/Filtration/Views/CrossButton.xaml
2015-06-04 18:15:54 +01:00

67 lines
3.9 KiB
XML

<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="clr-namespace:Filtration.UserControls">
<Style TargetType="{x:Type local:CrossButton}">
<Style.Resources>
<SolidColorBrush x:Key="NormalBackgroundBrush" Color="#00000000" />
<SolidColorBrush x:Key="NormalBorderBrush" Color="#FFFFFFFF" />
<SolidColorBrush x:Key="NormalForegroundBrush" Color="#FF8f949b" />
<SolidColorBrush x:Key="HoverBackgroundBrush" Color="#FFc13535" />
<SolidColorBrush x:Key="HoverForegroundBrush" Color="#FFf9ebeb" />
<SolidColorBrush x:Key="PressedBackgroundBrush" Color="#FF431e20" />
<SolidColorBrush x:Key="PressedBorderBrush" Color="#FF110033" />
<SolidColorBrush x:Key="PressedForegroundBrush" Color="#FFf9ebeb" />
</Style.Resources>
<Setter Property="Cursor" Value="Hand" />
<Setter Property="Focusable" Value="False" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type Button}">
<Grid Background="Transparent">
<!-- The background of the button, as an ellipse. -->
<Ellipse x:Name="backgroundEllipse" />
<!-- A path that renders a cross. -->
<Path x:Name="ButtonPath"
Margin="3"
Stroke="{StaticResource NormalForegroundBrush}"
StrokeThickness="1.5"
StrokeStartLineCap="Square"
StrokeEndLineCap="Square"
Stretch="Uniform"
VerticalAlignment="Center"
HorizontalAlignment="Center">
<Path.Data>
<PathGeometry>
<PathGeometry.Figures>
<PathFigure StartPoint="0,0">
<LineSegment Point="25,25"/>
</PathFigure>
<PathFigure StartPoint="0,25">
<LineSegment Point="25,0"/>
</PathFigure>
</PathGeometry.Figures>
</PathGeometry>
</Path.Data>
</Path>
</Grid>
<ControlTemplate.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter TargetName="backgroundEllipse" Property="Fill" Value="{StaticResource HoverBackgroundBrush}" />
<Setter TargetName="ButtonPath" Property="Stroke" Value="{StaticResource HoverForegroundBrush}"/>
</Trigger>
<!--<Trigger Property="IsEnabled" Value="false">
<Setter Property="Visibility" Value="Collapsed"/>
</Trigger>-->
<Trigger Property="IsPressed" Value="true">
<Setter TargetName="backgroundEllipse" Property="Fill" Value="{StaticResource PressedBackgroundBrush}" />
<Setter TargetName="backgroundEllipse" Property="Stroke" Value="{StaticResource PressedBorderBrush}" />
<Setter TargetName="ButtonPath" Property="Stroke" Value="{StaticResource PressedForegroundBrush}"/>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</ResourceDictionary>