6

Is there any solution to binding a textbox to a nullable decimal? Whenever you leave the textbox empty the binding is not updated. I know one solution is to use a string property instead but I really don't want to do it that way.

mariafoss
  • 83
  • 3

2 Answers2

16

You can do the trick by using TargetNullValue.

<TextBox Text="{Binding Value, TargetNullValue=''}"/>
alpha-mouse
  • 4,953
  • 24
  • 36
2

If simple bindings won't do you can always use a converter.

H.B.
  • 166,899
  • 29
  • 327
  • 400