Using the DatePicker and TimePicker
When building small and simple apps, you may choose to give your DatePicker
or TimePicker
a name and respond to its ValueChanged
event in your page code-beside file. The following excerpt shows a ValueChanged
event handler. DateTimeValueChangedEventArgs
contains both the value before being modified by the user, and the value after being modified:
void DatePicker_ValueChanged(object sender, DateTimeValueChangedEventArgs e){ DateTime? oldDataValue = e.OldDateTime; DateTime? newDateValue = e.NewDateTime;}
Alternatively, you may choose to rely on data binding and bind your control to a viewmodel property, as shown:
<toolkit:DatePicker Value="{Binding ...
Get Windows® Phone 8 Unleashed now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.