O'Reilly logo

Windows® Phone 8 Unleashed by Daniel Vaughan

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required