Replies: 1 comment
-
Maybe Attached properties could help you. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Summary
DependencyObject.SetCurrentValue() is available in WPF platform but missing in UWP
API Changes
DependencyObject.SetCurrentValue sets the value of a DependencyProperty without changing its value source.
Setting a DependencyProperty value in code obeys Dependency Property Precedence, but also any bindings to that property, template bindings or style setters to that property are overwritten, since setting a DProp in code has the 2nd highest precedence.
DependencyObject.SetCurrentValue allows you to set the value in code while propagating the value back to binding sources with TwoWay binding, and without overwriting the bindings or style setters.
Intended Use Case
Imagine you're a custom control vendor like us. We supply a control that has a property
We want our users to bind to this property and control it in a ViewModel
So far so good. But what if we had some logic inside our control that also needed to update the same property and propagate those changes to the ViewModel?
Concrete Example
We have a concrete example in our WPF Chart Control - SciChart.
Beta Was this translation helpful? Give feedback.
All reactions