WPF 自定义样式。CheckBox

    <Style x:Key="EmptyCheckBox" TargetType="CheckBox">
<Setter Property="Focusable" Value="False"/>
<Setter Property="IsTabStop" Value="False" />
<Setter Property="Height" Value="32"/>
<Setter Property="OverridesDefaultStyle" Value="True"/>
<Style.Triggers>
<Trigger Property="IsChecked" Value="True">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="CheckBox">
<Grid Background="Transparent" Cursor="Hand">
<VisualStateManager.VisualStateGroups>
<VisualStateGroup x:Name="CommonStates">
<VisualState x:Name="Disabled" />
<VisualState x:Name="Normal" />
<VisualState x:Name="MouseOver" />
<VisualState x:Name="Pressed" />
</VisualStateGroup>
</VisualStateManager.VisualStateGroups>
<Image Source="/FZHotel.MatroUIApp;component/Images/Button/check_ok.png"></Image>
<ContentPresenter Content="{TemplateBinding Content}"
ContentTemplate="{TemplateBinding ContentTemplate}"
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
VerticalAlignment="{TemplateBinding VerticalContentAlignment}" />
</Grid>
</ControlTemplate>
</Setter.Value>
</Setter>
</Trigger>
<Trigger Property="IsChecked" Value="False">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="CheckBox">
<Grid Background="Transparent" Cursor="Hand">
<VisualStateManager.VisualStateGroups>
<VisualStateGroup x:Name="CommonStates">
<VisualState x:Name="Disabled" />
<VisualState x:Name="Normal" />
<VisualState x:Name="MouseOver" />
<VisualState x:Name="Pressed" />
</VisualStateGroup>
</VisualStateManager.VisualStateGroups>
<Image Source="/FZHotel.MatroUIApp;component/Images/Button/check_cancel.png"></Image>
<ContentPresenter Content="{TemplateBinding Content}"
ContentTemplate="{TemplateBinding ContentTemplate}"
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
VerticalAlignment="{TemplateBinding VerticalContentAlignment}" />
</Grid>
</ControlTemplate>
</Setter.Value>
</Setter>
</Trigger>
</Style.Triggers>
</Style>

最新文章

  1. 第一章-第十一题(请问 “软件” 和 “软件工程” 这些词汇是如何出现的 - 何时、何地、何人)--By 侯伟婷
  2. C语言 06 指针
  3. AEAI CRM客户关系管理升级说明
  4. 【转】java正则表达式
  5. [转载] 动态链接库dll的 静态加载 与 动态加载
  6. A题笔记(8)
  7. 《Mathematical Olympiad——组合数学》——操作和游戏
  8. 连接远程hbase长时间等待问题
  9. maven 编
  10. C# lesson2
  11. [国嵌笔记][017][Makefile工程管理]
  12. 微信小程序之菜鸟入门教学(二)
  13. Eclipse工具常用快捷键
  14. VUE-开发工具VSCode
  15. Oracle列转行函数LISTAGG()
  16. Dell Technology Summit(2018.10.17)
  17. 13.BeanUtils组件-基础.md
  18. hdu 1.3.2 Moving Tables
  19. 学习Spring Boot:(十三)配置 Shiro 权限认证
  20. Intel Code Challenge Final Round (Div. 1 + Div. 2, Combined) A. Checking the Calendar 水题

热门文章

  1. node如何让一个端口同时支持https与http
  2. Unity3D游戏开发初探—3.初步了解U3D物理引擎
  3. 精简版StringBuilder,提速字符串拼接
  4. Golang与C#之switch区别
  5. spring官网下载
  6. 使用JavaMail创建邮件发送邮件
  7. 我的SQL总结---未完待续
  8. JavaScript易错点
  9. python基础总结篇——使用Mysql
  10. SSIS Destination 组件使用Fast-Load mode出错