WPF Button 样式

  1. WPF CheckBox 自定义样式
  2. 给Button设置ToolTip
    <Style TargetType="{x:Type Button}" x:Key="DefaultButton">
      <Setter Property="Foreground" Value="White"/>
        <Setter Property="FontFamily" Value="Microsoft YaHei"/>
        <Setter Property="FontSize" Value="12"/>
        <Setter Property="FontWeight" Value="Bold"/>
        <Setter Property="Template">
           <Setter.Value>
               <ControlTemplate TargetType="Button">
                    <Border BorderBrush="{TemplateBinding Control.BorderBrush}" BorderThickness="0" CornerRadius="5,5,5,5">
                       <Border.Background>
                           <LinearGradientBrush EndPoint="0,1" StartPoint="0,0">
                                <GradientStop Color="#FF32515B" Offset="0.0" />
                                <GradientStop Color="#FF274954" Offset="0.2" />
                                <GradientStop Color="#FF32515B" Offset="0.0" />
                           </LinearGradientBrush>
                       </Border.Background>
                       <ContentPresenter Content="{TemplateBinding ContentControl.Content}" HorizontalAlignment="Center" VerticalAlignment="Center" ></ContentPresenter>
                   </Border>
                </ControlTemplate>
           </Setter.Value>
       </Setter>
    </Style>

 

posted @ 2018-07-24 10:21  在 水 一 方  阅读(8274)  评论(0编辑  收藏  举报