Calendar Control in C#

Here you will see how to use the Calendar Control in C#.

The Calendar control is used to select and highlight dates.

Simple Calendar creation
  1. <controls:Calendar></controls:Calendar>  
Calendar display mode

Display mode=Month
  1. <controls:Calendar Name="Calender1" HorizontalAlignment="Left" Height="250" Width="250" DisplayMode="Month" VerticalAlignment="Top"></controls:Calendar> 
Calendar control

Display mode=Year
  1. <controls:Calendar Name="Calender2" HorizontalAlignment="Left" Height="250" Width="250" DisplayMode="Year" VerticalAlignment="Top"></controls:Calendar> 
Calendar control in C#

Display mode=Decade
  1. <controls:Calendar Name="Calender3" HorizontalAlignment="Left" Height="250" Width="250" DisplayMode="Decade" VerticalAlignment="Top"></controls:Calendar> 
Calendar control in C#

Select multiple dates
  1. <controls:Calendar Name="Calender4" HorizontalAlignment="Left" Height="250" Width="250" DisplayMode="Month" VerticalAlignment="Top" SelectionMode="MultipleRange" ></controls:Calendar> 
Calendar control in C#

Change Background color
  1. <controls:Calendar Name="Calender8" Background="CadetBlue" HorizontalAlignment="Left" Height="250" Width="250" DisplayMode="Month" VerticalAlignment="Top"></controls:Calendar> 
Calendar control in C#

Change Image Background
  1. <controls:Calendar Name="Calender5" HorizontalAlignment="Left" Height="250" Width="250" DisplayMode="Month"  DisplayDate="1/1/2011">  
  2.                     <basics:Calendar.Background>  
  3.                         <ImageBrush ImageSource="thumbnailCAKKSCJQ.jpg" Opacity="0.3"/>  
  4.                     </basics:Calendar.Background>  
  5.                 </controls:Calendar> 
Calendar control in C#

Change first date of the month
  1. <controls:Calendar Name="Calender6" HorizontalAlignment="Left" Height="250" Width="250" DisplayMode="Month" VerticalAlignment="Top" FirstDayOfWeek="Monday"></controls:Calendar> 
Calendar control in C#

Select date and block out dates of the month
  1. <controls:Calendar Name="Calender7" HorizontalAlignment="Left" Height="250" Width="250" DisplayMode="Month" VerticalAlignment="Top"></controls:Calendar>  

  1. Calender7.SelectedDate = new DateTime(2011,6,15);  
  2. Calender7.BlackoutDates.Add(new CalendarDateRange(DateTime.Now, new DateTime(2011, 6, 30)));

 

Calendar control in C#