datepicker,默认值未显示

时间:2017-03-04 15:45:04

标签: c# wpf datepicker

在WPF c#中,我有一个datepicker,它包含一个可以为null的日期时间。 我希望如果日期为空 - 当日历打开时 - 显示1960年至1969年之间的十年。如果日期时间具有显示日期的值,但首先在数十年的视图中打开它。

我确实喜欢这样,但它并没有向我展示几十年的日历,价值不是1960年

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

由于

0 个答案:

没有答案
相关问题