嗨,我想检查日期是否是假日,并更改日期前景 这是我的日历样式
<Style x:Key="CalendarDayButtonStyle" TargetType="primitives:CalendarDayButton">
<Setter Property="FocusVisualStyle" Value="{x:Null}"/>
<Setter Property="controls:HolidayHelper.Date" Value="{Binding}" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="primitives:CalendarDayButton">
<controls:SimplePanel>
<VisualStateManager.VisualStateGroups>
<VisualStateGroup x:Name="CommonStates">
...
</VisualStateGroup>
</VisualStateManager.VisualStateGroups>
<Rectangle RadiusX="16" RadiusY="16" x:Name="TodayBackground" Fill="{DynamicResource DangerBrush}" Opacity="0"/>
<Rectangle x:Name="SelectedBackground" Fill="{DynamicResource PrimaryBrush}" Opacity="0" RadiusY="16" RadiusX="16"/>
<ContentPresenter x:Name="NormalText" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}">
<ContentPresenter.Resources>
<Style TargetType="{x:Type ContentPresenter}">
<Setter Property="TextElement.Foreground" Value="#212121"/>
<Style.Triggers>
<Trigger Property="controls:HolidayHelper.IsHoliday" Value="True">
<Setter Property="TextElement.Foreground" Value="Red"/>
</Trigger>
</Style.Triggers>
</Style>
</ContentPresenter.Resources>
</ContentPresenter>
</controls:SimplePanel>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
这是我的课程
private static bool CheckIsHoliday(DateTime date)
{
return true;
}
完整的课程代码是here(最新发布)
我使用了这些代码,但没有任何反应