tags:

views:

389

answers:

1

I'm hoping this is an easy answer, as I'm just learning WPF.

I've got a resource dictionary that defines all our styles. Currently the checkbox style looks like:

<Style x:Key="StandardCheckboxStyle" TargetType="{x:Type CheckBox}">
    <Setter Property="Foreground" Value="{Binding Source={StaticResource BrandInfo}, XPath=//Colors/@TextColor}"/>
    <Setter Property="FontSize" Value="12"/>
</Style>

The XPath stuff is so that an end user could theoretically swap out the color pallete. There is an XML file obviously backing the colors we use. Currenlty TextColor is white and the background for the app is a darkish gray. Obviously when a checkbox is disabled and the text greys out we lose alot of contrast.

So how do you changed the text color of a checkbox when it's set IsEnabled="False"?

+1  A: 

you need a trigger

check this answer: http://stackoverflow.com/questions/371879/wpf-button-isenabled-based-on-combobox-selection-overwriting-default-style/371892#371892

this is pretty much the same way

Natrium
Thanks that's perfect.
Joel Barsotti