O'Reilly logo

Windows Presentation Foundation 4.5 Cookbook by Pavel Yosifovich

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Binding to a single object

Although element to element binding is occasionally useful, the classic data binding scenario involves an element bound to pure data. One of the benefits of this kind of binding is a decoupling of data from the way it's presented (if at all). All later changes are performed on the data only, letting the binding take care of updating whatever elements are bound to this data. In this recipe, we'll look at binding to a single data object.

Getting ready

Make sure Visual Studio is up and running.

How to do it...

We'll create some controls that bind to a single Person object, showing the basics of element to data binding.

  1. Create a new WPF application named CH06.SingleObjectBinding.
  2. Open MainWindow.xaml. Change the existing Grid ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required