The reason why I am asking this is because I was recommended by @Greg D (from this question) to use SetCurrentValue() instead, but a look at the docs and didn’t see whats the difference. Or whats does "without changing its value source" mean?
Sets the local value of a dependency property, specified by its
dependency property identifier.
Sets the value of a dependency property without changing its value
source.
The MSDN link you provided says it quite well:
Suppose you’re writing the
TextBoxcontrol and you’ve exposed aTextproperty that people often use as follows:In your control’s code, if you call
SetValueyou will overwrite the binding with whatever you provide. If you callSetCurrentValue, however, will ensure that the property takes on the given value, but won’t destroy any bindings.To the best of my knowledge, Greg’s advice is incorrect. You should always use
GetValue/SetValuefrom your CLR wrapper property.SetCurrentValueis more useful in scenarios where you need a property to take on a given value but don’t want to overwrite any bindings, triggers, or styles that have been configured against your property.