#1,035 – DatePicker Basics

The DatePicker is a control that operates like the Calendar control, allowing the user to select a date, but does so in a dropdown calendar that appears when the user clicks on a calendar icon in the control.  Unlike the Calendar control, the DatePicker allows selecting only a single date.

    <StackPanel>
        <Label Content="Calendar:"/>
        <Calendar />

        <Label Content="DatePicker:" Margin="0,10,0,0"/>
        <DatePicker Margin="5,0"/>
    </StackPanel>

The DatePicker looks a bit like a TextBox, with an area to enter some text and a calendar icon to the right.

1035-001

If you click on the calendar icon in the DatePicker, a calendar appears as a popup, allowing selection of a date.

1035-002

Once you select a date, the date is then displayed in the text area.

1035-003

You can also type a date manually into the text area of the DatePicker.

1035-004

Advertisement