Thursday, April 03, 2008

Book Review: Programming WPF: Second Edition by Chris Sells and Ian Griffiths

Written by T. Michael Testi


Window Presentation Foundation (WPF) is the foundation for the next generation of Windows applications. WPF represents the best of the control-based Windows world that is tied with the best content-based Web world. Added to this is the graphic performance of DirectX and the deployment capabilities of ClickOnce and you now have a whole new world of applications just waiting to be developed.


While this is still uncharted territory — and no one knows where it will lead in five, ten, or fifteen years down the road — if it is anything like the last 15 years of Windows programming, it will be interesting.


Programming WPF is for developers and assumes you have some experience with some sort of programming environment. Knowing how to program in .NET and C# is pretty much required. Windows Forms, XML, and HTML are also recommended. You will not be taught how to program here. Programming WPF is a hefty 863 pages and is contained in 18 chapters. Don't drop it on your foot!


Chapter 1, "Hello WPF," begins in traditional style with the basics of the WPF technology and a whirlwind tour of the features that will be covered in the following chapters. This way you can see how everything fits together before getting down into the details.


Chapter 2, "Applications and Settings," focuses on the bigger picture. Some of the items covered here are application lifetime, keeping track of open windows, and application states and settings.


Chapter 3, "Layout," discusses the tools that manage the visual layout of your applications and how to use the tools. By handling many of the mundane tasks such as resizing and handling localization, developers can focus their attention on the more critical portions of layout.


Chapter 4, "Input," now takes a look at how to make your application respond to user input. Here the authors take you through some low level input handling as well as the higher-level command system.


Chapter 5, "Controls," describes the controls built into the WPF Framework and how they form the building blocks of a user interface, as well as how you can adjust their properties, and even use templates to replace the whole look of the control.


Chapter 6, "Simple Data Binding," examines how to use WPF's data binding features to connect the user interface to your underlying data. By the use of WPF's data binding engine, you will get more features with less code.


Chapter 7, "Binding to List Data," continues the tracks laid down in chapter six by now showing how binding works with lists of items as well as how to bind with hierarchical data. This includes expanding a single data source into a set of target UI elements, as well as working with XML and relational data.


Chapter 8, "Styles," is a powerful mechanism to control your applications appearance while ensuring consistency. Just as with a word processing document, in which a style is a set of properties applied to ranges of content, a WPF style is applied to visual rendering content to change appearances.


Chapter 9, "Control Templates," examines the capabilities available for customizing the appearance of your user interface and the controls it contains. By using control templates, you can replace the complete look of the built-in controls without changing the existing behavior.


Chapter 10, "Windows and Dialogs," discusses the WPF window class, how it works, and how it provides the facilities necessary to build your dialog windows.


Chapter 11, "Navigation," shows that although WPF supports traditional navigation, it also supports web-like navigation. This includes navigation between content, one page at a time. Here you will learn how to use these services, as well as how to use the XBAP deployment model.


Chapter 12, "Resources," explains how to use the mechanisms for managing styles and themes, as well as binary resources, such as graphics. Here you will use resources to plug in visual features where they are needed to ensure the right look and feel.


Chapter 13, "Graphics," describes the powerful drawing primitives available within WPF. This is not just for designers. Now it is easy to add graphical elements to your design. Because WPF's graphics capabilities are now so vast, this chapter just scratches the surface of what is available.


Chapter 14, "Text and Flow Documents," focuses on the text services available wherever text is used. Discussed here is the text object model that defines how text is formatted. Also described is the FlowDocuments used to present large volumes of mixed text and graphics optimized for screen viewing.


Chapter 15, "Printing and XPS," takes a look at how printing in WPF is tied to the XML paper specification. XPS not only lets you spool your print, but you can send the XPS file to someone else via email as a preview of what the printed output will look like. Additionally, because of the powerful support, you can now use the majority of the graphical features in print, as well as on screen.


Chapter 16, "Animation and Media," describes the animation facilities contained in WPF that allow most of the visual aspects of a user interface to be animated. This is helpful to let the user know the application is still active, as well as providing for transitions from one view to another.


Chapter 17, "3D Graphics," can be hosted in the user interface, as well as projecting 2D and user interfaces on to 3D surfaces. This chapter does not look at how to create 3D graphics, but rather how WPF does 3D graphics.


Chapter 18, "Custom Controls," shows you that even though one of the benefits of WPF is that you do not have to write custom controls as often, when you do need to you still can. This chapter will show you how to write custom controls and other common element types.


While Programming WPF does not go in to deep detail on all topics, it does get deep enough on most of the topics to give you everything you need to know to get up to speed and working with WPF. The authors provide a good blend of clear and concise writing, concrete examples, and helpful code to make a good learning experience.


Programming WPF is a book that serves two masters. First, it provides an excellent introductory text for those who are new to WPF. Sure, you have to have experience programming, but this book will get you up to speed in a logical manner without much pain and with reference to the past. Second, it provides a good reference book that covers the topics of WPF. When you are up to your knickers in molasses, it will provide a great reference book to refresh your memory, so it retains its usefulness long after.


While WPF is going to take Windows programmers to territories yet undiscovered, Programming WPF is here to make sure you get started down that road with an owner's manual and a set of maps. If you want to learn WPF, then Programming WPF is a great place to start.