CalendarDatePicker Control For Windows 10

CalendarDatePicker represents a control that allows a user to pick a date from a calendar display. 

Step 1: Open a blank app and add CalendarDatePicker and Textblock control either from the toolbox or by copying the following XAML code into your grid.

  1. <StackPanel>  
  2.     <TextBlock Text="CalenderDate Picker" FontSize="20"></TextBlock>  
  3.     <StackPanel Orientation="Horizontal" Margin="20,30,0,0">  
  4.         <CalendarDatePicker Name="myCalender" PlaceholderText="choose a date" DateChanged="myCalender_DateChanged"></CalendarDatePicker>  
  5.         <TextBlock Name="selectedDate" Margin="10,0,0,0" Foreground="Green"></TextBlock>  
  6.     </StackPanel>  
  7. </StackPanel>  

 

 
 
Step 2: Copy and paste the following code to the myCalender_DateChanged event in  the cs page.  
  1. DateTime date = args.NewDate.Value.LocalDateTime;  
  2. DateTimeFormatter dtf = new DateTimeFormatter("shortdate");  
  3. selectedDate.Text ="The selected date is "+ dtf.Format(date).ToString();  
 Step 3: Run your application and select a date. The selected date will be shown in our assigned TextBlock: