In the previous article "WPF 4 calendar control (calendar)", we had a basic understanding of how to use the calendar control, this article will continue to introduce another new control "datepicker" in WPF 4 ). Compared with calendar, datepicker has a textbox to extract the date selected from the calendar.
For more information about datepicker attribute settings, see the calendar control. OnlyDisplaymode,SelectionmodeAttribute cannot be used in datepicker. First look at the following XAMLCode:
< Datepicker X : Name = "Datepickerctl" Width = "200" Height = "25" Selecteddateformat = "Long" Firstdayofweek = "Monday" Displaydatestart = "2010/4/1" Displaydateend = "2010/4/20" Istodayhighlighted = "False"> < Datepicker. blackoutdates > < Calendardaterange Start = "2010/4/3" End = "2010/4/5"/> < Calendardaterange Start = "2010/4/10" End = "2010/4/12"/> </ Datepicker. blackoutdates > </ Datepicker >
OnlySelecteddateformatThe attribute does not appear in the calendar control. This attribute is mainly used to set the display mode of the selected date:Long,Short. The two display methods are the same as the system calendar date format.
Long and Short display results:
Datepicker also supports direct Date input. For example, enter the date "2010/4/15" in the textbox, and click calendar to display the filled Date:
References
1. WPF 4 calendar control (calendar)
Http://www.cnblogs.com/gnielee/archive/2010/04/11/wpf4-calendar-control.html
2. datepicker class
Http://msdn.microsoft.com/en-us/library/system.windows.controls.datepicker (V = vs.100). aspx