Date picker

The date picker gives you a standardized way to let users pick a localized date value using touch, mouse, or keyboard input.

Example of date picker

Get the Windows UI Library

WinUI logo

Windows UI Library 2.2 or later includes a new template for this control that uses rounded corners. For more info, see Corner radius. WinUI is a NuGet package that contains new controls and UI features for Windows apps. For more info, including installation instructions, see Windows UI Library.

Platform APIs: DatePicker class, Date property

Is this the right control?

Use a date picker to let a user pick a known date, such as a date of birth, where the context of the calendar is not important.

For more info about choosing the right date control, see the Date and time controls article.


XAML Controls Gallery
XAML controls gallery

If you have the XAML Controls Gallery app installed, click here to open the app and see the DatePicker in action.

The entry point displays the chosen date, and when the user selects the entry point, a picker surface expands vertically from the middle for the user to make a selection. The date picker overlays other UI; it doesn't push other UI out of the way.

Example of the date picker expanding

Create a date picker

This example shows how to create a simple date picker with a header.

<DatePicker x:Name="birthDatePicker" Header="Date of birth"/>
DatePicker birthDatePicker = new DatePicker();
birthDatePicker.Header = "Date of birth";

The resulting date picker looks like this:

Example of date picker

Note  For important info about date values, see DateTime and Calendar values in the Date and time controls article.

Get the sample code