1 <!--自定义按钮样式-->
2 <LinearGradientBrush x:Key="LinearGradientBlueBackground" EndPoint="0.5,1" StartPoint="0.5,0">
3 <GradientStop Color="#FF377FED" Offset="0" />
4 <GradientStop Color="#FF074CC0" Offset="1" />
5 </LinearGradientBrush>
6 <SolidColorBrush x:Key="MyBtnBorderColor" Color="#FF2D78F4" />
7 <SolidColorBrush x:Key="MyBtnHoverBackgroundColor" Color="#3096FF" />
8 <SolidColorBrush x:Key="MyBtnPressedBackgroundColor" Color="#0067CF" />
9 <!--END-->
10
11 <Style x:Key="StlLoginBtnStyle" TargetType="{x:Type Button}" >
12 <Setter Property="Background" Value="{StaticResource LinearGradientBlueBackground}" />
13 <Setter Property="Foreground" Value="#FFFFFF" />
14 <Setter Property="FontSize" Value="36" />
15 <Setter Property="FontFamily" Value="MicrosoftYaHei" />
16 <Setter Property="Width" Value="560" />
17 <Setter Property="Height" Value="100" />
18 <Setter Property="BorderBrush" Value="{StaticResource MyBtnBorderColor}" />
19 <Setter Property="Template">
20 <Setter.Value>
21 <ControlTemplate TargetType="{x:Type Button}">
22 <Border x:Name="border" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Background="{TemplateBinding Background}"
23 SnapsToDevicePixels="true" CornerRadius="3,3,3,3">
24 <ContentPresenter x:Name="contentPresenter"
25 Focusable="False"
26 HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
27 Margin="{TemplateBinding Padding}"
28 RecognizesAccessKey="True"
29 SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"
30 VerticalAlignment="{TemplateBinding VerticalContentAlignment}" Content="立即登录"/>
31 </Border>
32 <ControlTemplate.Triggers>
33 <Trigger Property="IsMouseOver" Value="true">
34 <Setter Property="Background" TargetName="border" Value="{StaticResource MyBtnHoverBackgroundColor}"/>
35 </Trigger>
36 <Trigger Property="IsPressed" Value="true">
37 <Setter Property="Background" TargetName="border" Value="{StaticResource MyBtnPressedBackgroundColor}" />
38 </Trigger>
39 </ControlTemplate.Triggers>
40 </ControlTemplate>
41 </Setter.Value>
42 </Setter>
43 </Style>