尝试绑定 Windows 10 CalendarDatePicker 的日期时出现 XamlParseException

XamlParseException while trying to bind Date of Windows 10 CalendarDatePicker

我正在尝试将 CalendarDatePicker 的日期属性与 Windows 10 通用应用程序中的日期时间 属性 绑定:

<CalendarDatePicker
    Date="{Binding ClientDetailsViewModel.BirthDate,
    Converter={StaticResource DateTimeToDateTimeOffsetConverter} }"
    Foreground="{StaticResource TextGreyBrush}"  />

我在视图初始化时遇到以下异常:

An exception of type 'Windows.UI.Xaml.Markup.XamlParseException' occurred in KLMMobile.UI.exe but was not handled in user code

WinRT information: Failed to assign to property 'Windows.UI.Xaml.Controls.CalendarDatePicker.Date'. [Line: 93 Position: 41]

我已经使用 DatePicker 对其进行了测试,它运行良好。

经过大量努力尝试绑定日期后,我通过使用触发器 DateChanged 并将 PlaceHolderText 与应该在开始时显示的 属性 绑定来克服了这个问题。

<CalendarDatePicker 
                 PlaceholderText="{Binding UpdateWorkingTimeModel.StartTime, Converter={StaticResource TicksToDateTimeConverter}, ConverterParameter='dd.MM.yyyy', Mode=TwoWay}">
                    <interactivity:Interaction.Triggers>
                        <interactivity:EventTrigger EventName="DateChanged">
                            <interactivity:InvokeCommandAction Command="{Binding DatePickedCommand}"/>
                        </interactivity:EventTrigger>
                    </interactivity:Interaction.Triggers>
                </CalendarDatePicker>