Skip to content

Instantly share code, notes, and snippets.

@Jalalx
Last active August 29, 2015 14:10
Show Gist options
  • Save Jalalx/a9bd4423102125b49974 to your computer and use it in GitHub Desktop.
Save Jalalx/a9bd4423102125b49974 to your computer and use it in GitHub Desktop.
<Button Width="15" Height="15" Panel.ZIndex="999" VerticalAlignment="Top" HorizontalAlignment="Right" Padding="5">
<Button.Template>
<ControlTemplate TargetType="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="#FFff5555"
StrokeThickness="2"
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="#FFc13535" />
<Setter TargetName="ButtonPath" Property="Stroke"
Value="#FFf9ebeb"/>
<Setter Property="Cursor" Value="Hand" />
<Setter Property="Focusable" Value="False" />
</Trigger>
<Trigger Property="IsEnabled" Value="False">
<Setter Property="Visibility" Value="Collapsed"/>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Button.Template>
</Button>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment