I have a custom control in which I created a custom DependencyProperty called TheObject that can contain a generic object.
<comp:MyControl TheObject="{Binding Country}" />
Sometimes, I need to set the TheObject internally (by code, internally to the control).
I did something like this:
this.TheObject = new Country();
But I realized that it is causing the loss of the DataBinding and the control becomes not responding to data changes.
What I really want is that this new object remains attached to the existing DataBinding of the property.
Use
SetCurrentValue: