Header bar removal

Apr 23, 2009 at 3:31 PM

I have come across a problem which requires only the month and day to be shown for picking and thus I need to eliminate the year being shown or the header appearing at all.  I don't suppose this is at all possible, is it?

I have everything else in place but am open to suggestions!

Thanks in advance,

Apr 29, 2009 at 1:10 PM
Unfortunately, to get this done you'll have to do a bit of work.  You'll have to gain access to the header button, "PART_HeaderButton".  You can do that by retreiving it from the visual tree once the Calendar layout is complete or retemplating CalendarItem.  With access to the header button you can setup a binidng for Visibility and IsEnabled to not show when in Year mode.
May 5, 2009 at 9:55 PM
Hi Kieran -

I would retemplate the Calendar with a new CalendarItem based on the contents of generic.xaml. In the ControlTemplate you will find "PART_HeaderButton", which you can modify (its contents) or make Hidden. The problem that remains is that keyboard shortcuts will still function properly. To address this you would have to subclass the Control and override OnKeyDown and add some logic to "ignore" the keyboard shortcuts that bring the user to the views you want to block. I would check out the ProcessCalendarKey function for some tips on how to do so. Without the header button or keyboard shortcuts users won't be able to access the other modes of the Calendar you wish to block.

-Eric, MSFT