简体   繁体   English

WPF日期选择器

[英]wpf datepicker

Ok i'm trying to style the datepicker from microsoft from their wpftoolkit.dll. 好吧,我试图从他们的wpftoolkit.dll样式化Microsoft的datepicker。 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. “显示日历”文本(显示当前选定日期的控件部分)的背景是位于日期选择器内部的“ DatePickerTextBox”。 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>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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