Data binding basics
In WPF, we use the Binding
class to create our bindings. In general, it is fair to say that every binding will contain four constituent parts. The first is the binding source; typically, this will be one of our View Models. The second is the path to the property from the source object that we would like to data bind to.
The third is the binding target; this will typically be a UI control. The fourth is the path to the property of the binding target that we want to bind to. Therefore, if one of our bindings do not work, it is most likely that one of these four things has not been set correctly.
It is important to stress that the target property will typically be from a UI control, because there is a data binding rule that states that the binding target must be a Dependency Property. The properties of most UI controls are Dependency Properties and so, this rule simply enforces that data normally travels in the direction from our View Model data sources to the binding target...