FallbackValue: Gets or sets the value when the binding is unable to return a value.
TargetNullValue: Gets or sets the value when the value of the source is null.
For instance, we have a label:
< Label Name="Label" Content="Value1" />
And a TextBox:
< TextBlock Text="{Binding ElementName=Label,Path=Content,FallbackValue=Value2,TargetNullValue=Value3}" />
We can test by doing the following operations respectively:
1.Do nothing,
2.Remove the Content="Value1"
3.Change Path=Content to Path=Content2
the text show in the Textbox will be:
Value1
Value3
Value2
No comments:
Post a Comment