简体   繁体   English

DatePicker日颜色WPF 4

[英]DatePicker day colors WPF 4

I have the following style for the text block in the dictionary 我在字典中的文本块具有以下样式

<Style TargetType="{x:Type TextBlock}">
    <Setter Property="HorizontalAlignment" Value="Left" />
    <Setter Property="VerticalAlignment" Value="Center" />
    <Setter Property="Margin" Value="5,0,0,0 "/>
    <Setter Property="Foreground" Value="White" />
</Style>

after setting this in the resource dictionary, all the text block i have used in my project have foreground color to white which I have set, now the problem is that the datepicker control when open only shows the selected date, as I have set the foreground color of white for the text block in the above style the date picker control dates are not showing. 在资源字典中设置此选项后,我在项目中使用的所有文本块的前景颜色均为我设置的白色,现在的问题是,由于我设置了前景,datepicker控件在打开时仅显示选定的日期上面样式中的文本块的白色不显示日期选择器控件的日期。 Please help me as soon as possible as I am stuck in this problem :( 当我陷入这个问题时,请尽快帮助我:(

You can use additional style for your DatePicker: 您可以为DatePicker使用其他样式:

<DatePicker>
        <DatePicker.Resources>
            <Style TargetType="TextBlock">
                <Setter Property="Foreground" Value="Black"/>
            </Style>
        </DatePicker.Resources>
    </DatePicker>

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

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