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

WPF Calendar Control


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}" >
        <CalendarDateRange Start="01/01/2010" End="01/06/2010" />
        <CalendarDateRange Start="05/01/2010" End="05/03/2010" />

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" />

Last modified: 2010-03-01 22:32:47
Copyright (c) by Christian Moser, 2011.

 Comments on this article

Show all comments
Commented on 7.March 2010
good one.
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...
Commented on 22.April 2010
that's a good one
Commented on 19.August 2010
that great.
good luck
Commented on 19.August 2010
Helpful.Thanks! How to blackout all weekend
Commented on 14.September 2010
This control very nice.
Commented on 11.October 2010
Hi, There is not calendar control in vs2008. In this case how to create calendar control
Ganesh Kumar
Commented on 10.November 2010
Hi christian.
I have a problem for you. My visual studio toolbox is not showing calender control.
gimme reply.

Thank You.
Ganesh Kumar
Commented on 10.November 2010
I'm using Visual Studio 2008 Professional Edition. Thanks
Commented on 15.November 2010
Do you get .NET 4.0?
Sateesh kumar.V
Commented on 15.November 2010
I am using visual studio 2008 and i am not getting calendar control.how to import that calendar control to my application.can anyone help me..

Thanks in advance.
Commented on 20.November 2010
I am using VS 2010 , Thanks a ton
Madhu Kumar K.S
Commented on 14.December 2010
Hi christian,
i do not know how to implement ajax for calender.plz give me reply
Aarti Varadkar
Commented on 21.December 2010
Helpful for beginners
Commented on 19.January 2011
how to add assembly reference for Calendar control? Please help.
Commented on 5.February 2011
I am getting an error as Error The name 'InitializeComponent' does not exist in the current context could you please help me
Commented on 16.February 2011
Hi, can I disable years before 1900 ? just to restrict the user from entering date of birth which calculates his age more than 100 years..
Commented on 1.March 2011
Is there any option to go back instead of selection?
Example: suppose if i click on 2010(on disply of january 2010) it will show year format. Now i want to go back to previous with out selecting any year. Is it possible...

Thanks & Regards,
Christof Ammann
Commented on 7.March 2011
Could I style just the „Days of the month“ in a CalendarDayButtonStyle? They are looking to weightily compared the title (Januar 2010)?
I figured out that I unfortunately just can Style the „Days of the Month“ with the „Numbers of the Days“ like the size and the font.
Christof Ammann
Commented on 7.March 2011
Hi Christian

Sorry for my question where I asked if I only could set the "Days of the month".
Of course I can. I always ment it would be in the CalendarDayButtonStyle, but it is the CalendarItemStyle.

Greez Christof
Commented on 31.March 2011
Can you catch the event when the user selects a year (when in decade mode) or month (when in year mode)? Or even disable the switch to month view?
Commented on 8.June 2011
Subscribe on the events provided by the Calendar Control. DisplayDateChanged, DisplayModeChanged or SelectedDatesChanged.

The event arguments passed by this control (Calendar Control) event has a property of what we need.

If you need further explanation, just post it here.
prem tiwary
Commented on 1.July 2011
hi, thanks...
it's very.........good
Sanjay kumar
Commented on 13.September 2011
nice 1 i love dis site............
Commented on 14.September 2011
how to remove ShowNextPrevMonth=false in wpf??
Rajeev Kumarr
Commented on 19.September 2011
I am using WPF in VS 2008 but i am not getting calender control in tool box.I also tried to add from component but its not there. Can you please help me.

E-Mail (optional)