Reputation: 1911
I am thinking about the following issue.
If I have for example a textbox/slider/combobox which value is bound to something like
<TextBox Name=textBox Text="{Binding Text}"/>
and then do
textBox.Text = "something"
Is it going to "override" the binding or is binding "stronger" then explicit assignment
Upvotes: 2
Views: 617
Reputation: 81253
No it won't update your binding. Binding gets updated only when it comes from View, if you set it from your code behind, it will override the text but will break the binding. You can try this sample -
If you want to update the binding, you have to set the Dependency property from your code behind like this-
textBox.SetCurrentValue(TextBox.TextProperty, "Button2");
where textBox is your name of the TextBox.
Upvotes: 2
Reputation: 12458
Just simply put the value you will like to be in the textbox in the "Text" memeber of the bound object. Otherwise the binding will be overwritten, as devdigital mentioned above.
Upvotes: 1