Browse Source

TimePicker: fixed bug when trying to use a Custom format and FormatString. Reved to 1.4.0.2.

pull/1645/head
brianlagunas_cp 16 years ago
parent
commit
c39ed7c020
  1. 13
      ExtendedWPFToolkitSolution/Src/WPFToolkit.Extended/DateTimeUpDown/Implementation/DateTimeUpDown.cs
  2. 4
      ExtendedWPFToolkitSolution/Src/WPFToolkit.Extended/Properties/AssemblyInfo.cs

13
ExtendedWPFToolkitSolution/Src/WPFToolkit.Extended/DateTimeUpDown/Implementation/DateTimeUpDown.cs

@ -54,11 +54,7 @@ namespace Microsoft.Windows.Controls
protected virtual void OnFormatChanged(DateTimeFormat oldValue, DateTimeFormat newValue) protected virtual void OnFormatChanged(DateTimeFormat oldValue, DateTimeFormat newValue)
{ {
_dateTimeParser.Format = GetFormatString(newValue); _dateTimeParser.Format = GetFormatString(newValue);
InitializeDateTimeInfoListAndParseValue();
//if using a CustomFormat then the initialization occurs on the CustomFormatString property
if (newValue != DateTimeFormat.Custom)
InitializeDateTimeInfoListAndParseValue();
Text = ConvertValueToText(); Text = ConvertValueToText();
} }
@ -83,10 +79,9 @@ namespace Microsoft.Windows.Controls
protected virtual void OnFormatStringChanged(string oldValue, string newValue) protected virtual void OnFormatStringChanged(string oldValue, string newValue)
{ {
if (string.IsNullOrEmpty(newValue)) if (string.IsNullOrEmpty(newValue))
throw new ArgumentException("CustomFormat should be specified.", FormatString); throw new ArgumentException("FormatString should be specified.", "newValue");
_dateTimeParser.Format = newValue; _dateTimeParser.Format = newValue;
InitializeDateTimeInfoListAndParseValue(); InitializeDateTimeInfoListAndParseValue();
} }
@ -258,6 +253,10 @@ namespace Microsoft.Windows.Controls
_dateTimeInfoList.Clear(); _dateTimeInfoList.Clear();
string format = GetFormatString(Format); string format = GetFormatString(Format);
if (format == null)
return;
while (format.Length > 0) while (format.Length > 0)
{ {
int elementLength = GetElementLengthByFormat(format); int elementLength = GetElementLengthByFormat(format);

4
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 // You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below: // by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")] // [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.4.0.1")] [assembly: AssemblyVersion("1.4.0.2")]
[assembly: AssemblyFileVersion("1.4.0.1")] [assembly: AssemblyFileVersion("1.4.0.2")]
[assembly: XmlnsPrefix("http://schemas.microsoft.com/winfx/2006/xaml/presentation/toolkit/extended", "extToolkit")] [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")] [assembly: XmlnsDefinition("http://schemas.microsoft.com/winfx/2006/xaml/presentation/toolkit/extended", "Microsoft.Windows.Controls")]

Loading…
Cancel
Save