Browse Source

DateTimeUpdown: fixed bug when user typed in date/time for the Value Property in xaml then clicking the up/down arrows without making a selection.

pull/1645/head
brianlagunas_cp 15 years ago
parent
commit
5ff349863c
  1. 22
      ExtendedWPFToolkitSolution/Src/WPFToolkit.Extended/DateTimeUpDown/DateTimeUpDown.cs

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

@ -59,14 +59,6 @@ namespace Microsoft.Windows.Controls
InitializeDateTimeInfoList();
}
protected override void OnValueChanged(object oldValue, object newValue)
{
//whenever the value changes we need to parse out the value into out DateTimeInfo segments so we can keep track of the individual pieces
ParseValueIntoDateTimeInfo();
base.OnValueChanged(oldValue, newValue);
}
#endregion //Constructors
#region Base Class Overrides
@ -85,6 +77,14 @@ namespace Microsoft.Windows.Controls
base.OnPreviewKeyDown(e);
}
protected override void OnValueChanged(object oldValue, object newValue)
{
//whenever the value changes we need to parse out the value into out DateTimeInfo segments so we can keep track of the individual pieces
ParseValueIntoDateTimeInfo();
base.OnValueChanged(oldValue, newValue);
}
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
@ -378,6 +378,12 @@ namespace Microsoft.Windows.Controls
{
_fireSelectionChangedEvent = false;
DateTimeInfo info = _selectedDateTimeInfo;
//this only occurs when the user manually type in a value for the Value Property
if (info == null)
info = _dateTimeInfoList[0];
switch (info.Type)
{
case DateTimePart.Year:

Loading…
Cancel
Save