I have a Listview and a Textboxbinded to the selected item.
When the user deletes the value in the textbox (which is a double), I get the following error : Value '' cannot be converted. So I had TargetNullValue='', like this :
<TextBox x:Name="textBoxVoltage" Text="{Binding Voltage, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged, TargetNullValue=''}" />
But I still get the error....What am I doing wrong ? Thanks.
The issue is that your
Voltageis of the typedoubleand''cannot be converted to double.You can change the
Voltagetype todouble?which will allow you to do this.The alternative is using a converter, but then assuming
0and empty are the same thing: