When Binding, I know it is possible to create a fallback value; If your xaml can't find the property you are binding to, it will 'fall back' to whatever you put here. You can also create a targetNullValue, just in case your binding returns null.
Many people seem to struggle with how you to go about setting up a fallback value - (see here or here), but these don't quite answer my question, which is:
If my binding evaluates to Null, is there a way to update it to the targetNullValue? - I don't just want it to display on the UI, I want it to change my backing variable itself from Null to the fallback value.
Once IntitializeComponent(); is called, I want myBackerString to return "overrideNull";
<ContentControl
Content="{Binding myBackerString,
TargetNullValue='overrideNull',
Mode=TwoWay}"
/>
public String myBackerString
{
{ get { return (String)GetValue(testBackerProperty); }
{ set { SetValue(testBackerProperty); }
}
public static readonly DependencyProperty testBackerProperty =
DependencyProperty.Register("testBacker", typeof(String), typeof(myClass), new PropertyMetadata(null));