13

Practical WPF Data Binding

by Christian Nagel

This chapter provides practical information on data binding with Windows Presentation Foundation (WPF). It leads you on a journey to see various aspects of data binding and how you can use it. Simple object binding, as well as list binding (including validation and how to deal with large lists), are explained. Don't expect to see cool user interfaces (UIs) with WPF in this chapter. The UI is kept simple. Various features of WPF for styling, animations, and three dimensional (3D) are not discussed. This chapter focuses only on data binding with WPF.

SAMPLE APPLICATION

The sample application used in this chapter is based on a Formula 1 database. Instead of just binding to in-memory data, a database with several tables and thousands of rows demonstrates data-binding features. You can download the database, along with the sample code for this chapter, on this book's companion website (www.wrox.com).

The database contains information about Formula 1 racers, circuits, and race results. With the application, racers can be queried and changed, and race results can be added.

Figure 13-1 shows the database structure. The Circuits table contains information about all Formula 1 circuits that have been raced on. You can find the race date for circuits in the Races table. Each record in the Races table connects to a list of records in RaceResults. An entry in RaceResults contains a link to one record in the Racers table and one record in the ...

Get Real World .NET 4, C#, and Silverlight®: Indispensible Experiences from 15 MVPs now with O’Reilly online learning.

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