C# 具有未显示的默认值的日期选择器
在WPF c#中,我有一个日期选择器,它保存可以为null的日期时间。 我希望如果日期为空——日历打开时——显示1960-1969年之间的十年。如果日期时间具有显示日期的值,但首先在“时间”视图中打开它 我喜欢这个,但它不向我开放几十年的日历,其价值不是1960年C# 具有未显示的默认值的日期选择器,c#,wpf,datepicker,C#,Wpf,Datepicker,在WPF c#中,我有一个日期选择器,它保存可以为null的日期时间。 我希望如果日期为空——日历打开时——显示1960-1969年之间的十年。如果日期时间具有显示日期的值,但首先在“时间”视图中打开它 我喜欢这个,但它不向我开放几十年的日历,其价值不是1960年 <Style x:Key="styleCalendar" TargetType="{x:Type Calendar}"> <Setter Property="Template"> <
<Style x:Key="styleCalendar" TargetType="{x:Type Calendar}">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type Calendar}">
<!-- Wrapping in ViewBox will enlarge calendar of that size.-->
<Viewbox Height="500"
Width="500">
<CalendarItem x:Name="PART_CalendarItem"
Background="{TemplateBinding Background}"
BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}" />
</Viewbox>
</ControlTemplate>
</Setter.Value>
</Setter>
<Setter Property="DisplayMode" Value="Decade"></Setter>
</Style>
谢谢我看不到您设置默认值的地方。您试图在哪里设置默认值?另外,您的实际日历元素声明是什么样子的?