简体   繁体   中英

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 ie gray out all of the background?

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>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM