31 lines
1.6 KiB
XML
31 lines
1.6 KiB
XML
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
|
|
<!--定义一个按钮的通用样式-->
|
|
<Style TargetType="Button" x:Key="WindowControlButtonStyle">
|
|
<Setter Property="Width" Value="40"/>
|
|
<Setter Property="Height" Value="30"/>
|
|
<Setter Property="Foreground" Value="White"/>
|
|
<Setter Property="Template">
|
|
<Setter.Value>
|
|
<!--定义按钮的背景图片及引用效果-->
|
|
<ControlTemplate TargetType="Button">
|
|
<Border Background="Transparent" Name="back" CornerRadius="0,10,0,10">
|
|
<TextBlock Text="{Binding Content,RelativeSource={RelativeSource AncestorType=Button,Mode=FindAncestor}}" VerticalAlignment="Center" HorizontalAlignment="Center" FontFamily="../Fonts/#iconfont"/>
|
|
</Border>
|
|
<!--触发事件-->
|
|
<ControlTemplate.Triggers>
|
|
<!--鼠标移动上去产生变化效果-->
|
|
<Trigger Property="IsMouseOver" Value="True">
|
|
<Setter TargetName="back" Property="Background" Value="#22FFFFFF"/>
|
|
</Trigger>
|
|
<!--鼠标点击的是否把颜色深一点儿-->
|
|
<Trigger Property="IsPressed" Value="True">
|
|
<Setter TargetName="back" Property="Background" Value="#44FFFFFF"/>
|
|
</Trigger>
|
|
</ControlTemplate.Triggers>
|
|
</ControlTemplate>
|
|
</Setter.Value>
|
|
</Setter>
|
|
</Style>
|
|
|
|
</ResourceDictionary> |