Custom Checkbox style for WPF
Posted
by lorddarq
on Stack Overflow
See other posts from Stack Overflow
or by lorddarq
Published on 2010-04-14T10:40:09Z
Indexed on
2010/04/14
10:43 UTC
Read the original article
Hit count: 1643
I would like to skin a wpf default checkbox to something custom. Since it does not really make sense to start off a entirely new control, i'd like to override the Windows Chrome template binding for the Bulletchrome sub component of the checkbox. However I cannot do this like I can with checkboxes for example.
tried using something like this to override the default style, but it seems to not compile like this
<Style x:Key="cb_BULLETSTYLE" TargetType="{x:Type BulletDecorator}">
<Setter Property="OverridesDefaultStyle" Value="true"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type BulletDecorator}">
<Border x:Name="Chrome" SnapsToDevicePixels="true" BorderBrush="{x:Null}" BorderThickness="0">
</Border>
<ControlTemplate.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter Property="Background" TargetName="Chrome" Value="#FF4C4C4C"/>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
© Stack Overflow or respective owner