Bind DatePicker

May 19, 2009 at 1:56 PM

After bind DatePicker, only for the selected date bigger than Now, it can be displayed in the textbox. If I want to display the datetime in the datepicker textbox for any selected date, how to do? Thanks.

My code:

<my:DatePicker   Width="Auto" x:Name="ScheduledDate" VerticalContentAlignment="Stretch" SelectedDate="{Binding Path=InspectionDate, Mode=TwoWay}" CalendarStyle="{DynamicResource myCalendar}"  Margin="0,5,0,0" SelectedDateFormat="Short"  />

May 19, 2009 at 8:49 PM

In a simple app, dates befoire DateTime.Now were selectable. Does InspectionDate enforce being DateTime.Now or later?


May 20, 2009 at 2:48 AM

Thanks Ben,

It's my wrong not to see the detail logic behide the page.

But still I has another question: by default, the "Sunday" is abbreviated to "Su", "Monday" to "Mo", "Tuesday" to "Tu","Wednesday" to "We", "Thursday" to "Th", "Friday" to "Fr", and 'Saturday" to "Sa"?

then how to display as"Sun", "Mon", "Tue", "Wed", "Thu", "Fri", and "Sat", it's similar like this:

Sun  Mon  Tue  Wed  Thu  Fri  Sat

  1      2      3      4      5     6    7




May 20, 2009 at 10:47 PM

The day titles come from the current DateTimeFormat.ShortestDayNames. Changing to other day lengths isn't supported. If you have any interest in compiling the toolkit code yourself, you can look at CalendarItem.SetMonthModeDayTitles.