diff --git a/ExtendedWPFToolkitSolution/Src/WPFToolkit.Extended/DateTimeUpDown/Implementation/DateTimeUpDown.cs b/ExtendedWPFToolkitSolution/Src/WPFToolkit.Extended/DateTimeUpDown/Implementation/DateTimeUpDown.cs index 082ec6ab..cc3876c6 100644 --- a/ExtendedWPFToolkitSolution/Src/WPFToolkit.Extended/DateTimeUpDown/Implementation/DateTimeUpDown.cs +++ b/ExtendedWPFToolkitSolution/Src/WPFToolkit.Extended/DateTimeUpDown/Implementation/DateTimeUpDown.cs @@ -27,6 +27,17 @@ namespace Microsoft.Windows.Controls //TODO: add minimum and maximum properties + #region DefaultValue + + public static readonly DependencyProperty DefaultValueProperty = DependencyProperty.Register("DefaultValue", typeof(DateTime), typeof(DateTimeUpDown), new UIPropertyMetadata(DateTime.Now)); + public DateTime DefaultValue + { + get { return (DateTime)GetValue(DefaultValueProperty); } + set { SetValue(DefaultValueProperty, value); } + } + + #endregion //DefaultValue + #region Format public static readonly DependencyProperty FormatProperty = DependencyProperty.Register("Format", typeof(DateTimeFormat), typeof(DateTimeUpDown), new UIPropertyMetadata(DateTimeFormat.FullDateTime, OnFormatChanged)); @@ -78,18 +89,6 @@ namespace Microsoft.Windows.Controls #endregion //FormatString - #region NullValue - - public static readonly DependencyProperty NullValueProperty = DependencyProperty.Register("NullValue", typeof(DateTime), typeof(DateTimeUpDown), new UIPropertyMetadata(DateTime.Now)); - public DateTime NullValue - { - get { return (DateTime)GetValue(NullValueProperty); } - set { SetValue(NullValueProperty, value); } - } - - - #endregion //NullValue - #region Value public static readonly DependencyProperty ValueProperty = DependencyProperty.Register("Value", typeof(DateTime?), typeof(DateTimeUpDown), new FrameworkPropertyMetadata(null, FrameworkPropertyMetadataOptions.BindsTwoWayByDefault, OnValueChanged, OnCoerceValue)); @@ -172,7 +171,7 @@ namespace Microsoft.Windows.Controls if (Value.HasValue) UpdateDateTime(1); else - Value = NullValue; + Value = DefaultValue; } protected override void OnDecrement() @@ -180,7 +179,7 @@ namespace Microsoft.Windows.Controls if (Value.HasValue) UpdateDateTime(-1); else - Value = NullValue; + Value = DefaultValue; } protected override void OnPreviewKeyDown(KeyEventArgs e) diff --git a/ExtendedWPFToolkitSolution/Src/WPFToolkit.Extended/NumericUpDown/Implementation/NumericUpDown.cs b/ExtendedWPFToolkitSolution/Src/WPFToolkit.Extended/NumericUpDown/Implementation/NumericUpDown.cs index 2e054b71..296562fa 100644 --- a/ExtendedWPFToolkitSolution/Src/WPFToolkit.Extended/NumericUpDown/Implementation/NumericUpDown.cs +++ b/ExtendedWPFToolkitSolution/Src/WPFToolkit.Extended/NumericUpDown/Implementation/NumericUpDown.cs @@ -19,6 +19,17 @@ namespace Microsoft.Windows.Controls #region Properties + #region DefaultValue + + public static readonly DependencyProperty DefaultValueProperty = DependencyProperty.Register("DefaultValue", typeof(decimal), typeof(NumericUpDown), new UIPropertyMetadata(default(decimal))); + public decimal DefaultValue + { + get { return (decimal)GetValue(DefaultValueProperty); } + set { SetValue(DefaultValueProperty, value); } + } + + #endregion //DefaultValue + #region Minimum public static readonly DependencyProperty MinimumProperty = DependencyProperty.Register("Minimum", typeof(decimal), typeof(NumericUpDown), new PropertyMetadata(Decimal.MinValue, OnMinimumPropertyChanged)); @@ -86,18 +97,6 @@ namespace Microsoft.Windows.Controls #endregion //FormatString - #region NullValue - - public static readonly DependencyProperty NullValueProperty = DependencyProperty.Register("NullValue", typeof(decimal), typeof(NumericUpDown), new UIPropertyMetadata(default(decimal))); - public decimal NullValue - { - get { return (decimal)GetValue(NullValueProperty); } - set { SetValue(NullValueProperty, value); } - } - - - #endregion //NullValue - #region SelectAllOnGotFocus public static readonly DependencyProperty SelectAllOnGotFocusProperty = DependencyProperty.Register("SelectAllOnGotFocus", typeof(bool), typeof(NumericUpDown), new PropertyMetadata(false)); @@ -212,7 +211,7 @@ namespace Microsoft.Windows.Controls if (Value.HasValue) Value += Increment; else - Value = NullValue; + Value = DefaultValue; } protected override void OnDecrement() @@ -220,7 +219,7 @@ namespace Microsoft.Windows.Controls if (Value.HasValue) Value -= Increment; else - Value = NullValue; + Value = DefaultValue; } protected override void OnPreviewKeyDown(KeyEventArgs e)