【问题标题】:Change foreground property of CalendarGlyph in CalendarDatePicker在 CalendarDatePicker 中更改 CalendarGlyph 的前景属性
【发布时间】:2017-01-02 09:42:55
【问题描述】:

我需要在 UWP 中更改 CalendarDatePicker 内 Segoe MDL2 Assets 字体的颜色,使其看起来像这样(蓝色图标):

我查看了我的应用的动态树,我认为我需要更改 CalendarDatePicker 中 CalendarGlyph 的“前景”属性:

我知道如何将样式应用于 CalendarDatePicker,但我不知道如何将样式应用于 CalendarDatePicker 内部的特定元素。

【问题讨论】:

  • 使用blend,右键元素,应该有style->edit copy之类的东西

标签: c# xaml uwp win-universal-app


【解决方案1】:

您需要覆盖 CalendarDatePickerCalendarGlyphForeground SolidColorBrush 资源:

<CalendarDatePicker>
    <CalendarDatePicker.Resources>
        <SolidColorBrush x:Key="CalendarDatePickerCalendarGlyphForeground" Color="CornflowerBlue"/>
    </CalendarDatePicker.Resources>
</CalendarDatePicker>

要将其应用于所有日历日期选择器,请适当地确定资源的范围(例如,将其放在 App.xaml.cs 中的 Application.Resources 资源字典中,以便在应用范围内应用)。

【讨论】:

  • 完美!这正是我想要的!
猜你喜欢
  • 1970-01-01
  • 2022-01-16
  • 2019-02-03
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2017-04-02
  • 1970-01-01
  • 2017-04-17
相关资源
最近更新 更多