In my code I have a string:
Dim a As String
a = "This string is dynamic"
In my XAML want to set the TargetNullValue
of my DataGridTextColumn
equal to a.
I know I can set TargetNullValue=This string is dynamic
, but, as implied, a is dynamic.
One solution would be to make an IValueConverter
and do something like:
<DataGridTextColumn Binding="{Binding variableName, Converter={StaticResource NullConverter}" />
If the object passed to your converter is null
, you can do your return your dynamic string.