WPF CheckBox 自定义样式
2013-08-12 15:25
555 查看
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>
相关文章推荐
- WPF自定义控件与样式(4)-CheckBox/RadioButton自定义样式
- 用WPF自定义CheckBox的样式
- WPF 自定义CheckBox样式
- WPF自定义控件与样式(4)-CheckBox/RadioButton自定义样式
- WPF自定义控件与样式(4)-CheckBox/RadioButton自定义样式
- 自定义checkbox样式
- WPF界面设计技巧(2)—自定义漂亮的按钮样式
- WPF DataGrid自定义样式
- Android 自定义CheckBox 样式
- 自定义表单样式之checkbox和radio
- WPF中Expander控件样式,ListBox的样式(带checkbox)恢复
- 记录一些WPF常用样式方便以后复用(二)(Button、CheckBox、输入账号密码框)(转)
- 自定义WPF 窗口样式{转}
- 自定义checkbox样式
- WPF自定义Button样式(按钮长度随Content长度自适应)
- HTML 中自定义checkbox样式
- Android中自定义CheckBox样式
- 【WPF】右下角弹出自定义通知样式(Notification)——简单教程
- 自定义样式的checkBox
- WPF自定义控件与样式(13)-自定义窗体Window & 自适应内容大小消息框MessageBox