From 8d02413ea01ae8a4df330acfc76e273b7b6e4f43 Mon Sep 17 00:00:00 2001 From: brianlagunas_cp Date: Sun, 6 Mar 2011 00:58:55 +0000 Subject: [PATCH] DateTimeUpDown: fixed bug when DateTimePart selection would not be correct when setting the Value property first in XAML. --- .../DateTimeUpDown/Implementation/DateTimeUpDown.cs | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/ExtendedWPFToolkitSolution/Src/WPFToolkit.Extended/DateTimeUpDown/Implementation/DateTimeUpDown.cs b/ExtendedWPFToolkitSolution/Src/WPFToolkit.Extended/DateTimeUpDown/Implementation/DateTimeUpDown.cs index c2b08cef..23fe1cf9 100644 --- a/ExtendedWPFToolkitSolution/Src/WPFToolkit.Extended/DateTimeUpDown/Implementation/DateTimeUpDown.cs +++ b/ExtendedWPFToolkitSolution/Src/WPFToolkit.Extended/DateTimeUpDown/Implementation/DateTimeUpDown.cs @@ -41,7 +41,7 @@ namespace Microsoft.Windows.Controls { //if using a CustomFormat then the initialization occurs on the CustomFormatString property if (newValue != DateTimeFormat.Custom) - InitializeDateTimeInfoList(); + InitializeDateTimeInfoListAndParseValue(); } #endregion //Format @@ -67,7 +67,7 @@ namespace Microsoft.Windows.Controls if (string.IsNullOrEmpty(newValue)) throw new ArgumentException("CustomFormat should be specified.", FormatString); - InitializeDateTimeInfoList(); + InitializeDateTimeInfoListAndParseValue(); } #endregion //FormatString @@ -198,6 +198,13 @@ namespace Microsoft.Windows.Controls #region Private + private void InitializeDateTimeInfoListAndParseValue() + { + InitializeDateTimeInfoList(); + if (Value != null) + ParseValueIntoDateTimeInfo(); + } + private void InitializeDateTimeInfoList() { _dateTimeInfoList.Clear();