Calendar Control in C#



The Calendar control is used to select and highlight dates.

Simple Calendar creation:

<controls:Calendar></controls:Calendar>

Calendar display mode:

Display mode=Month

<controls:Calendar Name="Calender1" HorizontalAlignment="Left" Height="250" Width="250" DisplayMode="Month" VerticalAlignment="Top"></controls:Calendar>
Calendar1.gif

Display mode=Year

<controls:Calendar Name="Calender2" HorizontalAlignment="Left" Height="250" Width="250" DisplayMode="Year" VerticalAlignment="Top"></controls:Calendar>
Calendar2.gif

Display mode=Decade

<controls:Calendar Name="Calender3" HorizontalAlignment="Left" Height="250" Width="250" DisplayMode="Decade" VerticalAlignment="Top"></controls:Calendar>
Calendar3.gif

To select multiple dates:

<controls:Calendar Name="Calender4" HorizontalAlignment="Left" Height="250" Width="250" DisplayMode="Month" VerticalAlignment="Top" SelectionMode="MultipleRange" ></controls:Calendar>
Calendar4.gif

To change Background color:

<controls:Calendar Name="Calender8" Background="CadetBlue" HorizontalAlignment="Left" Height="250" Width="250" DisplayMode="Month" VerticalAlignment="Top"></controls:Calendar>
Calendar5.gif

To change image Background:

<controls:Calendar Name="Calender5" HorizontalAlignment="Left" Height="250" Width="250" DisplayMode="Month"  DisplayDate="1/1/2011">
                    <basics:Calendar.Background>
                        <ImageBrush ImageSource="thumbnailCAKKSCJQ.jpg" Opacity="0.3"/>
                    </basics:Calendar.Background>
                </controls:Calendar>
Calendar6.gif

To change first date of the month:

<controls:Calendar Name="Calender6" HorizontalAlignment="Left" Height="250" Width="250" DisplayMode="Month" VerticalAlignment="Top" FirstDayOfWeek="Monday"></controls:Calendar>
Calendar7.gif

To Select date and block out dates of the month:

<controls:Calendar Name="Calender7" HorizontalAlignment="Left" Height="250" Width="250" DisplayMode="Month" VerticalAlignment="Top"></controls:Calendar>

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

Calendar8.gif 

 

Up Next
    Ebook Download
    View all
    Learn
    View all