从 Datepicker 检索值到通知

Retrieving value from Datepicker to notifications

我的应用程序是 Windows phone 8.1,就像一个提醒,为此我需要检索用户设置的日期和时间,并在指定的时间发出通知时间和日期,我的代码是:

  // Get the begin time for the notification by combining the DatePicker
  // value and the TimePicker value.
        DateTime date = (DateTime)FromDatePicker.Value;

        DateTime time = (DateTime)Reminder1.Value;
        DateTime beginTime = date + time.TimeOfDay;

但问题是我在输入 .Value 时遇到错误,例如:

错误 1 ​​'Windows.UI.Xaml.Controls.DatePicker' 不包含 'Value' 的定义,并且找不到接受类型 'Windows.UI.Xaml.Controls.DatePicker' 的第一个参数的扩展方法 'Value'(您是否缺少using 指令或程序集引用?)

我不知道如何替换此“.Value”以获得通知的准确值?

试试这个:

DateTime SelectedDate = MyDatePicker.Date.Date;

您可以像这样从日期选择器中获取选定的值:

DateTime date = FromDatePicker.Date