CalendarView Control For Windows 10

Introduction 

 
CalendarView represents a control that enables a user to select a date by using a visual calendar display. 
 
Step 1
 
Open a blank app and add CalendarView and Textblock control either from the toolbox or by copying the following XAML code into your grid.
  1. <TextBlock Text="Calender View" FontSize="20">  
  2. </TextBlock>    
  3. <StackPanel Margin="0,15,0,0">    
  4.     <CalendarView Name="myCalender" Margin="20,20,0,0" SelectedDatesChanged="myCalender_SelectedDatesChanged" SelectionMode="Multiple" />    
  5.     <TextBlock Name="datesSelected" Foreground="Green" Margin="0,10,0,0">  
  6.     </TextBlock>    
  7. </StackPanel>     
Selection Mode defines whether to select single or multiple dates. 
 
 
 
Step 2
 
Copy and paste the following code to the myCalender_SelectedDatesChanged event on the cs page.
  1. var selectedDates = sender.SelectedDates.Select(p => p.Day.ToString() + "/" + p.Month.ToString()).ToArray();    
  2. var multipleDates = string.Join(", ", selectedDates);    
  3. datesSelected.Text = "The selected dayes are " + multipleDates;     
Step 3
 
Run your application and select a date. The selected dates will be shown in our TextBlock assigned.
 
  
 

Summary 

 
In this article, we learned about CalendarView Control For Windows 10.  

Up Next
    Ebook Download
    View all
    Learn
    View all