<Style TargetType="CheckBox"> <Setter Property="Template"> <Setter.Value> <ControlTemplate TargetType="CheckBox"> <StackPanel Orientation="Horizontal"> <Grid Height="20" Width="20"> <Image x:Name="imageNoChecked" Source="/MPCR.GE.Client.EmployeeManagement;component/Images/ckNoChecked.png" Height="32" Width="32" Margin="-12" /> <Image x:Name="imageChecked" Source="/MPCR.GE.Client.EmployeeManagement;component/Images/ckChecked.png" Height="32" Width="32" Margin="-12" /> </Grid> <Label Content="{TemplateBinding Content}" FontSize="{TemplateBinding FontSize}" Foreground="{TemplateBinding Foreground}" /> </StackPanel> <ControlTemplate.Triggers > <Trigger Property="IsChecked" Value="True"> <Setter TargetName="imageChecked" Property="Visibility" Value="Visible" /> <Setter TargetName="imageNoChecked" Property="Visibility" Value="Hidden" /> </Trigger> <Trigger Property="IsChecked" Value="False"> <Setter TargetName="imageChecked" Property="Visibility" Value="Hidden" /> <Setter TargetName="imageNoChecked" Property="Visibility" Value="Visible" /> </Trigger> </ControlTemplate.Triggers> </ControlTemplate> </Setter.Value> </Setter> </Style>
把图片地址换一下就行了,一个上为选中的样子,一张是选中后的图片
我先给你看看我的图片吧
我就这两张图片,回去试试吧,用法你懂的,不懂得Q我,QQ875556003
分类: WPF,WPF企业工作技巧 好文要顶 关注我 收藏该文 AYUI框架关注 - 152
粉丝 - 841 +加关注 1 0 « 上一篇:潜移默化学会WPF--绘图 学习(一)
» 下一篇:潜移默化学会WPF(样式篇)---改造ComboBox,全新metro风格