0

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.

Bhargav Rao
  • 50,140
  • 28
  • 121
  • 140
Turkwise
  • 137
  • 3
  • 17
  • Possible dup: http://stackoverflow.com/questions/10565213/how-to-bind-a-localized-string-in-the-targetnullvalue-attribute – Jason Tyler Oct 24 '13 at 17:42

1 Answers1

1

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.

gleng
  • 6,185
  • 4
  • 21
  • 35