Browse Source

DateTimeUpDown: added support for manually entering datTime values as strings in XAML into the Value property. Now you can do this:

<extToolkit:DateTimeUpDown Format="ShortTime" Value="2:00:00 AM" />
pull/1645/head
brianlagunas_cp 15 years ago
parent
commit
70fa0cf668
  1. 11
      ExtendedWPFToolkitSolution/Src/WPFToolkit.Extended/DateTimeUpDown/DateTimeUpDown.cs

11
ExtendedWPFToolkitSolution/Src/WPFToolkit.Extended/DateTimeUpDown/DateTimeUpDown.cs

@ -85,6 +85,17 @@ namespace Microsoft.Windows.Controls
base.OnPreviewKeyDown(e);
}
protected override object OnCoerceValue(object value)
{
//if the user entered a string value to represent a date or time, we need to parse that string into a valid DatTime value
if (value != null && !(value is DateTime))
{
return DateTime.Parse(value.ToString(), DateTimeFormatInfo);
}
return base.OnCoerceValue(value);
}
#endregion //Base Class Overrides
#region Event Hanlders

Loading…
Cancel
Save