Is there a way to bind to a Nullable property without using a value converter?
Currently I have this...
<DataGridTextColumn Header="ApplicationKey" Binding="{Binding ApplicationKey, ValidatesOnDataErrors=True, Converter={StaticResource ResourceKey=TestConverter}}" />
Without the converter it thinks of an empty textbox as a String.Empty instead of a Null.
I'm hoping there is some sort of magic property like TargetNullValue.
Yes, the TargetNullValue property on Binding should do exactly what you want. If you set TargetNullValue to the empty string, then the binding will convert the empty string to null and back:
<DataGridTextColumn Header="ApplicationKey" Binding=
"{Binding ApplicationKey, ValidatesOnDataErrors=True, TargetNullValue=''}" />
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With