I have a Textblock which Text attribute is binding to a DateTime? type data, and I want to show something when the DateTime? data is null.
The code below works great.
< TextBlock Text="{Binding DueDate, TargetNullValue='wow,It's null'}"/>
But what about if I want to bind a Localizedstring to the TargetNullValue?
The Code below not work 🙁
How to?
< TextBlock Text="{Binding DueDate, TargetNullValue={Binding LocalStrings.bt_help_Title1, Source={StaticResource LocalizedResources}} }"/>
I don’t see any way to do that with TargetNullValue. As a workaround, you can try using a converter:
Then add it to the resources of your page:
Finally, use it instead of TargetNullValue: