/// <summary> /// TextProperty property changed handler. /// </summary> /// <param name="d">DatePicker that changed its Text.</param> /// <param name="e">DependencyPropertyChangedEventArgs.</param> private static void OnTextChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) { DatePicker dp = d as DatePicker; Debug.Assert(dp != null); if (!dp.IsHandlerSuspended(DatePicker.TextProperty)) { string newValue = e.NewValue as string; if (newValue != null) { if (dp._textBox != null) { dp._textBox.Text = newValue; } else { dp._defaultText = newValue; } dp.SetSelectedDate(); } else { dp.SetValueNoCallback(DatePicker.SelectedDateProperty, null); } } }
/// <summary> /// Set the selected date. /// </summary> internal void SetSelectedDate() { _datePicker.SetSelectedDate(); }