Browse Source

Handled null value for FormatString.

pull/1375/head
Mathivanan Palanisamy 8 years ago
parent
commit
7a7ec3dd78
  1. 7
      ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit/NumericUpDown/Implementation/NumericUpDown.cs

7
ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit/NumericUpDown/Implementation/NumericUpDown.cs

@ -69,7 +69,7 @@ namespace Xceed.Wpf.Toolkit
#region FormatString #region FormatString
public static readonly DependencyProperty FormatStringProperty = DependencyProperty.Register( "FormatString", typeof( string ), typeof( NumericUpDown<T> ), new UIPropertyMetadata( String.Empty, OnFormatStringChanged ) ); public static readonly DependencyProperty FormatStringProperty = DependencyProperty.Register( "FormatString", typeof( string ), typeof( NumericUpDown<T> ), new UIPropertyMetadata( String.Empty, OnFormatStringChanged, OnCoerceFormatString) );
public string FormatString public string FormatString
{ {
get get
@ -89,6 +89,11 @@ namespace Xceed.Wpf.Toolkit
numericUpDown.OnFormatStringChanged( ( string )e.OldValue, ( string )e.NewValue ); 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 ) protected virtual void OnFormatStringChanged( string oldValue, string newValue )
{ {
if( IsInitialized ) if( IsInitialized )

Loading…
Cancel
Save