views:

1312

answers:

1
+1  Q: 

wpf datepicker

Ok i'm trying to style the datepicker from microsoft from their wpftoolkit.dll. I have it in a grid that is disabled, unfortunately it's background color stays white(despite it being disabled) unlike the other controls that gray out.

Ok I did do this:

    <Style TargetType="{x:Type tk:DatePicker}">
        <Style.Triggers>
            <Trigger Property="IsEnabled" Value="False">
                <Setter Property="Background" Value="LightGray"/>
            </Trigger>
        </Style.Triggers>
    </Style>

But the text inside it that displays "Show Calendar" still has a white background. How do I set a style to make it look like the other controls i.e. gray out all of the background?

+3  A: 

The background of the "Show Calendar" text (the part of the control that shows the currently selected date) is a "DatePickerTextBox" that's sitting inside the date picker. To set its background, use:

<Style TargetType="{x:Type tk:DatePickerTextBox}">
    <Style.Triggers>
        <Trigger Property="IsEnabled" Value="False">
            <Setter Property="Background" Value="LightGray"/>
        </Trigger>
    </Style.Triggers>
</Style>
JaredReisinger