Working With The Datepicker Control In Universal Window App


  • Visual Studio 2015

Now, let's get started with the steps, given below-

Step 1 - Create Windows Universal Project

Open Visual Studio 2015 and click File -> New -> Project Option for New Universal App.


Step 2 - Giving the Project Name

New Project Window will open, where you can select an Installed -> Template -> Visual C# -> Windows -> Universal and select a Blank App (Universal Windows).

Type Project Name DatePickerControl and click OK button.

Blank App

Step 3 - Setting the platform Versions

Here, we choose the Target Version and Minimum Version for our Universal Windows Application and click OK button.


Step 4 - Choose Designer Window

Now, we go to the Solution Explorer and select MainPage.xaml.

Solution Explore

Step 5 - Designing the App

Drag the DatePicker Control from the tool box and change the name to mydate in Property Window.


Next, add the Textblock from the tool box.


Step 6 - Add the Coding

To add coding, double click DatePicker Control and add the mentioned source code.


  1. private void mydate_DateChanged(object sender, DatePickerValueChangedEventArgs e)  
  2. {  
  3.     DateTimeFormatter dtf = new DateTimeFormatter("shortdate");  
  4.     textBlock.Text = "The selected date is " + dtf.Format(e.NewDate).ToString();  
  5. }  
Step 7 - Run the Application

Now, we are ready to run our project. Thus, click the Local Machine to run the Application.



I hope you understood Date Picker control in Universal Window and how to run it.