4

I don't currently have an example for my question. I would just like to get some insight of the following : When should one use one or two way data binding in XAML ?

Thank you in advance for the time you take to answer this !

4
  • 3
    Binding.Mode Property. and BindingMode Enumeration In summary: use OneWay if the property is readonly, use TowWay if you want to change it from your view. Commented Jan 6, 2015 at 17:00
  • Oh gee, that sounds really simple ! Thank you for the insight, you should write an answer and I'll check it as the answer for my query ! @Bolu Commented Jan 6, 2015 at 17:03
  • 1
    Assuming you've read about data binding it is very unclear what you are looking for here. Indeed you use one way when you need one way binding and twoway when you need updates both ways... So what exactly you are looking for with this question? Commented Jan 6, 2015 at 17:06
  • Currently, I'm in the process of learning my way around XAML/UI/MVVM. I read a bit on the web but was wondering when I should use which or even if I needed to use them while creating a Windows Phone Application Commented Jan 6, 2015 at 17:13

2 Answers 2

7

In summary: use OneWay if the property is readonly, use TowWay if you want to change it from your view.

  • TwoWay updates the target property or the property whenever either the target property or the source property changes.
  • OneWay updates the target property only when the source property changes.

REF:Binding.Mode Property. and BindingMode Enumeration

Sign up to request clarification or add additional context in comments.

Comments

2

Use OneWay if you only want to update the view from your model.

TwoWay also updates the model if you change the view. e.g. a TextBox. So you should use it when you want that your view can affect the model.

MSDN-Page BindingMode

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.