Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/wpf/14.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 具有未显示的默认值的日期选择器_C#_Wpf_Datepicker - Fatal编程技术网

C# 具有未显示的默认值的日期选择器

C# 具有未显示的默认值的日期选择器,c#,wpf,datepicker,C#,Wpf,Datepicker,在WPF c#中,我有一个日期选择器,它保存可以为null的日期时间。 我希望如果日期为空——日历打开时——显示1960-1969年之间的十年。如果日期时间具有显示日期的值,但首先在“时间”视图中打开它 我喜欢这个,但它不向我开放几十年的日历,其价值不是1960年 <Style x:Key="styleCalendar" TargetType="{x:Type Calendar}"> <Setter Property="Template"> <

在WPF c#中,我有一个日期选择器,它保存可以为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>


谢谢

我看不到您设置默认值的地方。您试图在哪里设置默认值?另外,您的实际日历元素声明是什么样子的?