diff --git a/ExtendedWPFToolkitSolution/Src/WPFToolkit.Extended/NumericUpDown/Implementation/NumericUpDown.cs b/ExtendedWPFToolkitSolution/Src/WPFToolkit.Extended/NumericUpDown/Implementation/NumericUpDown.cs index 667f3a12..96d0d0eb 100644 --- a/ExtendedWPFToolkitSolution/Src/WPFToolkit.Extended/NumericUpDown/Implementation/NumericUpDown.cs +++ b/ExtendedWPFToolkitSolution/Src/WPFToolkit.Extended/NumericUpDown/Implementation/NumericUpDown.cs @@ -23,13 +23,25 @@ namespace Microsoft.Windows.Controls #region FormatString - public static readonly DependencyProperty FormatStringProperty = DependencyProperty.Register("FormatString", typeof(string), typeof(NumericUpDown), new UIPropertyMetadata(String.Empty)); + public static readonly DependencyProperty FormatStringProperty = DependencyProperty.Register("FormatString", typeof(string), typeof(NumericUpDown), new UIPropertyMetadata(String.Empty, OnFormatStringChanged)); public string FormatString { get { return (string)GetValue(FormatStringProperty); } set { SetValue(FormatStringProperty, value); } } + private static void OnFormatStringChanged(DependencyObject o, DependencyPropertyChangedEventArgs e) + { + NumericUpDown numericUpDown = o as NumericUpDown; + if (numericUpDown != null) + numericUpDown.OnFormatStringChanged((string)e.OldValue, (string)e.NewValue); + } + + protected virtual void OnFormatStringChanged(string oldValue, string newValue) + { + Text = ConvertValueToText(); + } + #endregion //FormatString #region Increment @@ -54,9 +66,9 @@ namespace Microsoft.Windows.Controls private static void OnMaximumChanged(DependencyObject o, DependencyPropertyChangedEventArgs e) { - NumericUpDown integerUpDown = o as NumericUpDown; - if (integerUpDown != null) - integerUpDown.OnMaximumChanged((T)e.OldValue, (T)e.NewValue); + NumericUpDown numericUpDown = o as NumericUpDown; + if (numericUpDown != null) + numericUpDown.OnMaximumChanged((T)e.OldValue, (T)e.NewValue); } protected virtual void OnMaximumChanged(T oldValue, T newValue) @@ -77,9 +89,9 @@ namespace Microsoft.Windows.Controls private static void OnMinimumChanged(DependencyObject o, DependencyPropertyChangedEventArgs e) { - NumericUpDown integerUpDown = o as NumericUpDown; - if (integerUpDown != null) - integerUpDown.OnMinimumChanged((T)e.OldValue, (T)e.NewValue); + NumericUpDown numericUpDown = o as NumericUpDown; + if (numericUpDown != null) + numericUpDown.OnMinimumChanged((T)e.OldValue, (T)e.NewValue); } protected virtual void OnMinimumChanged(T oldValue, T newValue)