views:

2416

answers:

2

I can´t find a way to restyle the IsChecked indicator of a checkbox. As I can see from the checkbox template there´s no possibilities to restyle the indicator, just the "box" of the checkbox. Does anyone knows if it´s possibly to restyle the IsChecked indicator?

+1  A: 

You might find the following discussion helpful:

http://social.msdn.microsoft.com/Forums/en-US/wpf/thread/f8e3c903-5c82-46ec-a065-9a75d9f79b75/

People describe various ways of extracting or viewing the standard WPF control templates.

stusmith
+3  A: 

You will have to replace the entire CheckBox control template.

Start with the ChekcBox ControlTemplate MSDN example at http://msdn.microsoft.com/en-us/library/ms752319.aspx

In the example you'll see this element:

<Path 
Width="7" Height="7" 
x:Name="CheckMark"
SnapsToDevicePixels="False" 
Stroke="{StaticResource GlyphBrush}"
StrokeThickness="2"
Data="M 0 0 L 7 7 M 0 7 L 7 0" />

This is the indicator, in this sample the indicator is already an X, so change Stroke to Red and You're done.

To change the shape of the indicator change the Path's Data property.

Nir