Chapter 8. Data Binding

What Is Data Binding?

Oftentimes a visual element displays the representation of some underlying data value. In this case, you usually want to ensure that the visual element stays up-to-date and changes when the underlying data value changes.

For example, consider a window that contains two elements—a TextBox at the top and a Slider control beneath it. You'd like to have the TextBox represent the value of the Slider such that when you move the Slider back and forth, the value in the TextBox changes to show the Slider's current value. This is illustrated in Figure 8-1, which shows the window in three different states.

The value displayed in the TextBox is bound to the current value of the Slider.

Figure 8.1. The ...

Get Illustrated WPF now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.