Choosing a Binding Mode
The Binding class gives you the ability to determine how data can flow between the source and the target. This flow can be controlled by setting the Mode property of a Binding instance. This property represents one of the three options available in the BindingMode enumerator. This enumerator exposes the OneTime, OneWay, and TwoWay options.
OneTime
The OneTime binding mode sets the target property to the source property when a binding is initially made. When this BindingMode is used, any changes to the data source will not be automatically sent to the target. Instead, the target will only be set when the source is initialized as shown in Figure 2.
Figure 2 shows the simplistic binding nature of the OneTime BindingMode. As you can imagine, this BindingMode is appropriate in situations where you only care about the initial value of a property. For instance, you may want to display the "creation date" of a database record. Because this value should not change, the OneTime BindingMode is a great choice. However, for property values that will change, like the date/time that a database record was last modified, you may want to use the OneWay binding option.
OneWay
The OneWay BindingMode is the default option used when you create a Binding. This option gives you the ability to automatically receive changes from a source property. This means that whenever the binding source property changes, the target property will automatically change. However, the source property will not change if the target is altered. Either way, this change process is shown in Figure 3.
Figure 3 shows how the OneWay BindingMode works at a high level. Alternatively, you may think of the speedometer in your car as OneWay binding from your gas pedal. Essentially, when you press or release your foot from the gas pedal, the speedometer changes. However, if you somehow changed the value of the speedometer itself, your gas pedal would not change. This inability to send a change from the target back to the source shows how OneWay binding works. For situations where you do want to send changes in the target back to the source, you can use the TwoWay option.
TwoWay
TwoWay binding enables two properties that are bound to each other, to change each other. At first glance, this may sound recursive, however it's not. Essentially a TwoWay binding changes the target when the source changes. On the other hand, if the target changes, the source will be updated. This can be seen in Figure 4.
Figure 4 shows a conceptual view of TwoWay binding. This binding approach is useful for web-based forms using Silverlight. The reason why is because forms generally allow users to add, as well as edit, data. This process of editing pre-existing data practically begs for TwoWay binding.
The TwoWay BindingMode is one of the options available to control the flow of your data. The other alternatives are available through the OneWay and OneTime options. Collectively, these options are an important part of setting up a binding. However, after the target and binding mode have been selected, you need to choose an appropriate source.