From c39ed7c020591946958871c1850200457af0f49f Mon Sep 17 00:00:00 2001 From: brianlagunas_cp Date: Mon, 18 Apr 2011 15:42:30 +0000 Subject: [PATCH] TimePicker: fixed bug when trying to use a Custom format and FormatString. Reved to 1.4.0.2. --- .../DateTimeUpDown/Implementation/DateTimeUpDown.cs | 13 ++++++------- .../WPFToolkit.Extended/Properties/AssemblyInfo.cs | 4 ++-- 2 files changed, 8 insertions(+), 9 deletions(-) diff --git a/ExtendedWPFToolkitSolution/Src/WPFToolkit.Extended/DateTimeUpDown/Implementation/DateTimeUpDown.cs b/ExtendedWPFToolkitSolution/Src/WPFToolkit.Extended/DateTimeUpDown/Implementation/DateTimeUpDown.cs index c4c28e1e..a2064153 100644 --- a/ExtendedWPFToolkitSolution/Src/WPFToolkit.Extended/DateTimeUpDown/Implementation/DateTimeUpDown.cs +++ b/ExtendedWPFToolkitSolution/Src/WPFToolkit.Extended/DateTimeUpDown/Implementation/DateTimeUpDown.cs @@ -54,11 +54,7 @@ namespace Microsoft.Windows.Controls protected virtual void OnFormatChanged(DateTimeFormat oldValue, DateTimeFormat newValue) { _dateTimeParser.Format = GetFormatString(newValue); - - //if using a CustomFormat then the initialization occurs on the CustomFormatString property - if (newValue != DateTimeFormat.Custom) - InitializeDateTimeInfoListAndParseValue(); - + InitializeDateTimeInfoListAndParseValue(); Text = ConvertValueToText(); } @@ -83,10 +79,9 @@ namespace Microsoft.Windows.Controls protected virtual void OnFormatStringChanged(string oldValue, string newValue) { if (string.IsNullOrEmpty(newValue)) - throw new ArgumentException("CustomFormat should be specified.", FormatString); + throw new ArgumentException("FormatString should be specified.", "newValue"); _dateTimeParser.Format = newValue; - InitializeDateTimeInfoListAndParseValue(); } @@ -258,6 +253,10 @@ namespace Microsoft.Windows.Controls _dateTimeInfoList.Clear(); string format = GetFormatString(Format); + + if (format == null) + return; + while (format.Length > 0) { int elementLength = GetElementLengthByFormat(format); diff --git a/ExtendedWPFToolkitSolution/Src/WPFToolkit.Extended/Properties/AssemblyInfo.cs b/ExtendedWPFToolkitSolution/Src/WPFToolkit.Extended/Properties/AssemblyInfo.cs index 10644400..af5a5165 100644 --- a/ExtendedWPFToolkitSolution/Src/WPFToolkit.Extended/Properties/AssemblyInfo.cs +++ b/ExtendedWPFToolkitSolution/Src/WPFToolkit.Extended/Properties/AssemblyInfo.cs @@ -55,8 +55,8 @@ using System.Windows.Markup; // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("1.4.0.1")] -[assembly: AssemblyFileVersion("1.4.0.1")] +[assembly: AssemblyVersion("1.4.0.2")] +[assembly: AssemblyFileVersion("1.4.0.2")] [assembly: XmlnsPrefix("http://schemas.microsoft.com/winfx/2006/xaml/presentation/toolkit/extended", "extToolkit")] [assembly: XmlnsDefinition("http://schemas.microsoft.com/winfx/2006/xaml/presentation/toolkit/extended", "Microsoft.Windows.Controls")]