How to show and select only months in Calendar? [WPF 4.0, VB 2010]

Jul 24, 2009 at 5:29 AM

I want to make Calendar show and select only months, and while selecting month, the DisplayMode would stay Year (i.e. no month's dates should be displayed).

How to achieve it?

Jul 24, 2009 at 7:29 PM

The DisplayMode topic shows how to handle the DisplayModeChanged event and keep the mode the same.  You can't cancel the event, but you can change the DisplayMode in the event handler. When I tried it, I didn't see any flickering.  The calendar didn't respond to the user clicking the buttons.

Jul 27, 2009 at 5:19 AM
Edited Jul 27, 2009 at 5:20 AM

It works, but it has one quirk: I need to return DisplayMode property to Calendar.Year to display months again, but this makes triggering DisplayModeChanged event TWICE!

I can solve this problem with some helper variable to check state of changing, but it's too odd. It's a pity there's no elegant way to do this.