Book Review: Pro WPF in C# 2008

posted in: Book Reviews | 0
Title: Pro WPF in C# 2008
Subtitle: Windows Presentation Foundation with .NET 3.5, Second Edition
Publisher: Apress® Books for Professionals by Professionals™
Author: Matthew MacDonald
Date of appearance: February, 2008 (1040 Pages)

This book is a thorough examination of the WPF 3.5 technology—its architecture, what you can do with it and how to do it. It is directed at professional C# developers.

The book is written in a systematic, comprehensible way. A chapter starts with a basic introduction and includes graphics of the respective WPF class hierarchy. Step-by-step, the chapter's topic is then profoundly explored. For instance, at the beginning, there are five pages just on resolution independence. XAML is explained in-depth, starting with the four ways of loading and compiling: Code-only, code and uncompiled XAML, code and compiled XAML and XAML only. This is followed by the specifics of the XAML grammar (markup extensions, attached properties, etc.). There are seven pages on non-rectangular windows and sixteen pages on playing sound on different OS versions. As the book goes on, the author really shines in describing complex subjects, such as 3-D drawing, in a very logical, clearly understandable way. Towards the end, there is a tabular overview of features missing in WPF compared to Windows Forms, with recommendations on when to choose one over the other or both of them together and how to mix them best.

The volume also contains lots of small pieces of precious surplus information, such as:

  • Properties of WPF controls can be set in any order, without causing any change in behavior.
  • By using an overloaded version of DependencyObject.SetValue in code, you can attach a value for any dependency property, even if it is not defined as an attached property (which is not possible in XAML).

In addition, the author mentions various quirks of WPF and how to get around them (where possible). Examples:

  • When you restart an animation that is almost complete, and the animation had the current position as the starting point, the animation will appear to slow down.
  • Windows Vista always requires permission elevation for a setup, even though, in the case of Click Once, this makes no sense. As a consequence, a Click Once WPF application, on Vista, cannot be installed under a regular user account; the user is forced to install it under an admin account—which defeats the purpose of using Click Once in the first place...

Developers are only too familiar with the 80/20 Pareto principle of productivity. I can only recommend taking the time to study this 1040-page-book. It makes you much more productive, particularly during the challenging "remaining 20%" phase of your SPF project.