Home  separator  Controls  separator  Calendar
Bookmark and Share Share...    Subscribe to this feed Feed   About me...


WPF Calendar Control

Introduction

Since WPF 4.0, Microsoft provides a full featured calendar control. It provides the following features:

Set the displayed date

The calendar displays by default the current date. But you can specify any other date to be displayed by setting the DisplayDate property.

 
<Calendar DisplayDate="01.01.2010" />
 
 

Selection Modes

The calendar control provides multiple modes for selection. You can set the SelectionMode property to SingleDateSingleRange, MultipleRanges or None.

 
<Calendar SelectionMode="MultipleRange" />
 
 

Blackout dates

The calendar control provides a feature to black out dates that are not valid for selection. You can define multiple ranges by setting the BlackoutDates property to one or multiple CalendarDateRange.

 
<Calendar SelectionMode="{Binding SelectedItem, ElementName=selectionmode}" >
    <Calendar.BlackoutDates>
        <CalendarDateRange Start="01/01/2010" End="01/06/2010" />
        <CalendarDateRange Start="05/01/2010" End="05/03/2010" />
    </Calendar.BlackoutDates>
</Calendar>
 
 

Calendar Modes

The calendar supports three modes to display ranges of dates: Year, Month and Decade. You can control the mode by setting the DisplayMode property.

 
<Calendar DisplayMode="Year" />
 
 



 Comments on this article

Show all comments
vijay
Commented on 7.March 2010
good one.
z
Commented on 9.March 2010
How to make a google calendar like calendar? i.e. an interactive one tt I can add events or tasks to it...
smruti
Commented on 22.April 2010
that's a good one
morteza
Commented on 19.August 2010
that great.
good luck
ling
Commented on 19.August 2010
Helpful.Thanks! How to blackout all weekend

Name
E-Mail (optional)
Comment
About Christian Moser