Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Cannot bind empty textbox to nullable decimal with MVVM light

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.

like image 954
mariafoss Avatar asked Jan 21 '11 13:01

mariafoss


1 Answers

You can do the trick by using TargetNullValue.

<TextBox Text="{Binding Value, TargetNullValue=''}"/>
like image 109
alpha-mouse Avatar answered Nov 15 '22 08:11

alpha-mouse