简体   繁体   中英

How to select only years (or months) in WPF DatePicker?

I'm using the Datepicker that comes with visual studio 2010 but I can't find an option that lets me select only years, or only months of a given year.

(I see the wpf toolkit calendar supports this, but I'm wondering if maybe the one that comes with visual studio does as well?)

Duh, I should've just used the Calendar control with a popup. (Calendar supports DisplayMode)

will something like this work if you coded it..???

DateTime selectedDate = dateTimePicker1.Value;
int intMonth = DateTime.Month(selectedDate.Month);

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM