protected override void OnValueChanged( DateTime? oldValue, DateTime? newValue )
{
//The calendar only select the Date part, not the time part.
DateTime? newValueDate = (newValue != null)
? newValue.Value.Date
: (DateTime?)null;
if( _calendar != null && _calendar.SelectedDate != newValueDate)
{
_calendar.SelectedDate = newValueDate;
_calendar.DisplayDate = newValue.GetValueOrDefault( this.ContextNow );
}
//If we change any part of the datetime without
//using the calendar when the actual date is temporary,
//clear the temporary value.
if( _calendarTemporaryDateTime != null &&
newValue != _calendarTemporaryDateTime )
{
_calendarTemporaryDateTime = null;
_calendarIntendedDateTime = null;
}
base.OnValueChanged( oldValue, newValue );
}