I have a TextBlock tblControl and I want to set a binding
similar to xaml’s
Foreground="{Binding ForegroundColor}"
but in code. So I use:
var b = new Binding { Path = new PropertyPath("ForegroundColor") };
tblControl.SetBinding(TextBlock.ForegroundProperty, b);
Everything works.
Now I want to remove Binding to allow a TextBlock to show default Foreground color or I need to set default value of Foreground. tblControl.SetBinding(TextBlock.ForegroundProperty, null); is NOT WORKING. How to do it?
The following will clear a binding (or any other local value):