WPF Binding Mode

Kailash Chandra Behera | Sunday, August 14, 2016

Introduction

This article describes what is WPF Binding Mode and how many types of binding modes available in WPF.

Getting Started

WPF Binding helps to flow data from one object to another object and Binding mode defines how data will flow from one object to another object. There are 5 different modes available in WPF listed below.

  1. OneWay:-Causes changes to the source property to automatically update the target property but the source does not get changed.
  2. TwoWay:-Changes in the source or target automatically cause updates to the other.
  3. OneTime:-Causes only the first time change to the source property to automatically update the target property but the source does not get changed and subsequent changes do not affect the target property.
  4. OneWayToSource:-Causes changes to the target property to automatically update the source property but the target does not get changed.
  5. Default:-The default is Default, which returns the default binding mode value of the target dependency property. However, the default value varies for each dependency property. In general, user-editable control properties, such as those of text boxes and checkboxes, default to two-way bindings, whereas most other properties default to one-way bindings.

To support OneWay and TwoWay bindings, the underlying data must implement INotifyPropertyChanged and for TwoWay or OneWayToSource bindings, you can control the target-to-source updates by setting the UpdateSourceTrigger property.

Related Articles

  1. Resource in WPF
  2. WPF Style
  3. WPF Triggers
  4. WPF Converters
  5. UpdateSourceTrigger
  6. WPF Binding

Summary

In this article we have discussed the mode of binding in WPF and type of binding mode, I hope this article may helpful to you.

Thanks