datetimepicker with different format only months and days

I am looking for a way to create a DateTimePicker in c# wpf in which it will appear only month and days. Not year.

How to do this?
GasAsked:
Who is Participating?
 
Kyle AbrahamsConnect With a Mentor Senior .Net DeveloperCommented:
Try setting the custom format:
https://msdn.microsoft.com/en-us/library/system.windows.forms.datetimepicker.customformat(v=vs.110).aspx
dateTimePicker1.Format = DateTimePickerFormat.Custom;
dateTimePicker1.CustomFormat = "MM/dd";

Open in new window




If you want to restrict it to the current year you can use
   dateTimePicker1.MinDate = new DateTime(Datetime.Now.Year, 1,1);
   dateTimePicker1.MaxDate = new DateTime(Datetime.Now.Year, 12,31);

Open in new window


and finally set the mode to month:
https://msdn.microsoft.com/en-us/library/system.windows.controls.calendar.displaymode(v=vs.110).aspx
private void Calendar_DisplayModeChanged(object sender,
                                         CalendarModeChangedEventArgs e)
{
    Calendar calObj = sender as Calendar;

    calObj.DisplayMode = CalendarMode.Month;
}

Open in new window

0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.