What are the various WPF binding modes?

Source: https://stackoverflow.com/questions/2305179/what-are-the-various-wpf-binding-modes


  • OneWay: Use this when you want the bound property to update the user interface.
  • TwoWay: This has the same behavior as OneWay and OneWayToSource combined. The bound property will update the user interface, and changes in the user interface will update the bound property (You would use this with a TextBox or a Checkbox for example.)
  • OneTime: This has the same behavior as OneWay except it will only update the user interface one time. This should be your default choice for binding (for various reasons I won’t elaborate on here), you should only use other types of bindings if you actually need the extra functionality.
  • OneWayToSource: This is the opposite of OneWay — user interface value changes update the bound property.

If you don’t specify anything, then the behavior will depend on the control that you are using.

For more info, see BindingMode enum on MSDN.

 

Leave a Comment