Chapter 3. Data Binding in WPF
In This Chapter
Understanding dependency properties
Understanding binding modes
Defining an example binding object
Editing, converting, and visualizing data
Data binding allows data from your application objects (the binding source) to be displayed in your user interface elements (the binding target). What this means is that you can bind a Textbox's Text property (for example) to the Name property of an instance of your Car class. Depending on the binding mode used when setting up the relationship, changes in the Text property value of the Textbox can automatically update the underlying Name property of your Car object (and vice versa) without requiring any additional code.
It's no mystery these days that most applications deal with data. As a WPF developer, you have full creative reign on how data is presented, and how information entered by your user can be validated and used to update your underlying objects. One of WPF's strengths is its rich data binding support. This chapter walks you through the details.
Getting to Know Dependency Properties
Data binding happens when you set up a relationship between a binding source property with a binding target property. The binding target object must be a
DependencyObject, and the target property must be a
Understanding dependency properties is crucial to obtaining a firm grasp on WPF technology. Dependency properties are found in objects that inherit from
DependencyObject. At its root, a dependency ...