Calendar Questions

Dec 3, 2008 at 12:03 PM


Thanks for Calendar control.  Finally we have WPF control.  I found some questions when I started to use Calendar control:

  1. How to show all 12 month in the calendar.  I found only how to show one month only.  In WinForms MonthCalendar control I could specify CalendarDimensions (i.e. 3, 4) and get all 12 months of the year.  I need the same functionality in this calendar.  How can I do it?
  2. I have business requirements, users should be able to view calendar and navigate between months and years, but they should not be able to select any days.  How can I prevent them from selecting dates?  I used SelectionMode="None" but it still allows me to select dates in the calendar.
  3. I have list of BlackoutDates, how can I use binding to show them in the calendar?  I can do it via code, but could not find the way of doing it in XAML.
  4. I need to show BlackoutDates in Red color, how can I do that?
  5. How can I change size of the Calendar?  Whatever I do with Width or Hight It always stays the same size.
  6. Where can I find more documentation or examples on Calendar control?

Thanks a lot.


Dec 3, 2008 at 8:35 PM
To answer your questions:

1) You can set the DisplayMode to Year
2) You can modify the calendar such that it never enters Month Mode but maintains a SelectedDate which includes that month. (Let me know if this option is of any interest to you and we can assist you with it).
3) You can modify CalendarBlackoutDatesCollection's Start and End Properties to be Dependency Properties (DP), though there may be other ways around this. Either way, DPs are required for DataBinding.
4) You will have to modify/override the Calendar's ControlTemplate for CalendarDayButton. Check out the source in Generic.xaml and look for a Path element with x:Name="Blackout"
5)You can use a ScaleTransform
6) I would search the forums, we will be releasing additional documentation on MSDN in the future. If you have any particular questions though, we are happy to help :-)

-Eric Fabricant, MSFT