diff --git a/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit/NumericUpDown/Implementation/NumericUpDown.cs b/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit/NumericUpDown/Implementation/NumericUpDown.cs index 0d9e0de5..7841c5c2 100644 --- a/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit/NumericUpDown/Implementation/NumericUpDown.cs +++ b/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit/NumericUpDown/Implementation/NumericUpDown.cs @@ -69,7 +69,7 @@ namespace Xceed.Wpf.Toolkit #region FormatString - public static readonly DependencyProperty FormatStringProperty = DependencyProperty.Register( "FormatString", typeof( string ), typeof( NumericUpDown ), new UIPropertyMetadata( String.Empty, OnFormatStringChanged ) ); + public static readonly DependencyProperty FormatStringProperty = DependencyProperty.Register( "FormatString", typeof( string ), typeof( NumericUpDown ), new UIPropertyMetadata( String.Empty, OnFormatStringChanged, OnCoerceFormatString) ); public string FormatString { get @@ -89,6 +89,11 @@ namespace Xceed.Wpf.Toolkit numericUpDown.OnFormatStringChanged( ( string )e.OldValue, ( string )e.NewValue ); } + private static object OnCoerceFormatString(DependencyObject d, object baseValue) + { + return baseValue ?? string.Empty; + } + protected virtual void OnFormatStringChanged( string oldValue, string newValue ) { if( IsInitialized )