wpf datepicker [英] wpf datepicker
问题描述
好的,我试图从他们的wpftoolkit.dll的微软风格的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.
我确实做到这一点:
<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?
推荐答案
显示日历文本(显示当前选定日期的控件部分)是位于日期选择器中的DatePickerTextBox。要设置其背景,请使用:
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>
这篇关于wpf datepicker的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!