Selecting Dates with the DatePicker Control

The DatePicker control shows a pop-up calendar where you can pick a date; the date is then bound to a text box placed near the control. The DatePicker is used in data-binding techniques (see Chapter 32). The following XAML code shows how you can implement a DatePicker; the selection, which is mapped by the SelectedDate property of type Date, is then bound to a second, external text box to demonstrate how the value can be consumed by other user controls:

<StackPanel Orientation="Horizontal">    <DatePicker Name="DatePicker1" Margin="5"            SelectedDateChanged="DatePicker1_SelectedDateChanged" />    <TextBox Name="TextBox2" Margin="5"             Text="{Binding ElementName=DatePicker1, ...

Get Visual Basic 2015 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.