DatePicker 日期颜色 WPF 4

发布于 2024-09-12 19:23:03 字数 480 浏览 2 评论 0原文

在资源字典中设置后,我在字典中的文本块具有以下样式

<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>

,我在项目中使用的所有文本块的前景色都为我设置的白色,现在的问题是打开时的日期选择器控件仅显示所选日期,因为我已将上述样式中的文本块的前景色设置为白色,因此日期选择器控件日期不显示。请尽快帮助我,因为我陷入了这个问题:(

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. Please help me as soon as possible as I am stuck in this problem :(

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

沩ん囻菔务 2024-09-19 19:23:03

您可以为 DatePicker 使用其他样式:

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

You can use additional style for your DatePicker:

<DatePicker>
        <DatePicker.Resources>
            <Style TargetType="TextBlock">
                <Setter Property="Foreground" Value="Black"/>
            </Style>
        </DatePicker.Resources>
    </DatePicker>
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文