37 lines
1.8 KiB
XML
37 lines
1.8 KiB
XML
<Button x:Class="CustomWindow.WindowButton"
|
|
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
|
SnapsToDevicePixels="True"
|
|
x:Name="myUcName">
|
|
<Button.Resources>
|
|
<SolidColorBrush x:Key="DefaultBackgroundBrush" Color="#66000000" />
|
|
</Button.Resources>
|
|
<Button.Template>
|
|
<ControlTemplate TargetType="Button">
|
|
<Border x:Name="MainBorder" BorderBrush="#000000"
|
|
BorderThickness="0" CornerRadius="{Binding ElementName=myUcName, Path=CornerRadius}"
|
|
Width="{TemplateBinding Width}" Height="{TemplateBinding Height}" Background="{TemplateBinding Background}">
|
|
<Grid>
|
|
<Border x:Name="HighlightBorder" CornerRadius="{Binding ElementName=myUcName, Path=CornerRadius}">
|
|
<ContentControl x:Name="ContentPlaceHolder" VerticalAlignment="Center" Content="{Binding ElementName=myUcName, Path=ActiveContent}" Margin="0" />
|
|
</Border>
|
|
</Grid>
|
|
</Border>
|
|
<ControlTemplate.Triggers>
|
|
<Trigger Property="IsMouseOver" Value="True">
|
|
<Setter TargetName="HighlightBorder" Property="Background" Value="{Binding Path=Foreground, RelativeSource={RelativeSource TemplatedParent}}" />
|
|
</Trigger>
|
|
</ControlTemplate.Triggers>
|
|
</ControlTemplate>
|
|
</Button.Template>
|
|
<Button.Style>
|
|
<Style TargetType="Button">
|
|
<Setter Property="Width" Value="30" />
|
|
<Setter Property="Height" Value="35" />
|
|
<Setter Property="Background" Value="{StaticResource DefaultBackgroundBrush}" />
|
|
<Setter Property="Foreground" Value="#AFAFAF">
|
|
</Setter>
|
|
</Style>
|
|
</Button.Style>
|
|
</Button>
|