Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Do you know a WPF MonthPicker control?

I'm looking for a MonthPicker control, a control just like a DatePicker but that you can only select the month and the year.

Before start writing one from scrath I would like to know if something like this exists.

like image 855
Eduardo Molteni Avatar asked Sep 08 '10 22:09

Eduardo Molteni


2 Answers

I have used System.Windows.Controls.Calendar in this way:

Calendaer used as MonthPicker

(that's in Hebrew, but I'd guess you got the Idea...)

XAML:

<Calendar Name="dteSelectedMonth" DisplayMode="Year" SelectionMode="None" 
          DisplayModeChanged="dteSelectedMonth_DisplayModeChanged" />

Code behind to keep calendar on Year mode:

    private void dteSelectedMonth_DisplayModeChanged(object sender, CalendarModeChangedEventArgs e)
    {
        dteSelectedMonth.DisplayMode = CalendarMode.Year;
    }

And I've used dteSelectedMonth.DisplayDate value to get the selected month.

You might want to insert that Calendar into an Expander or a ComboBox with binding to SelectedMonth

like image 116
itsho Avatar answered Oct 02 '22 14:10

itsho


Finally made my own. It needs some polish, but works:

alt text

Usercontrol VB code at https://dl.dropboxusercontent.com/u/16351501/MonthPicker.zip

like image 38
Eduardo Molteni Avatar answered Oct 02 '22 12:10

Eduardo Molteni