質問

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.

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top