Change binding value, not binding itself
Posted
by Sam
on Stack Overflow
See other posts from Stack Overflow
or by Sam
Published on 2010-05-27T14:18:47Z
Indexed on
2010/05/27
14:31 UTC
Read the original article
Hit count: 432
I've got a WPF UserControl containing a DependencyProperty (MyProperty).
The DependencyProperty is bound to a Property in the DataContext.
Now in the UserControl I want to change the value of the bound property. But if I assign MyProperty = NewValue
the Binding is lost and replaced by NewValue.
What I want to achieve is change the DataContext-property the DependencyProperty is bound to.
How do I achieve this instead of changing the binding?
To clarify: using something like MyTextBox.Text = "0";
I'll release the binding. How would I set Text, leave the binding intact so the property Text is bound to will change, too.
© Stack Overflow or respective owner