This book is designed to give you a working knowledge of Windows Presentation Foundation (WPF). The assumption is that the reader is already a .NET developer with some familiarity with other UI technologies (WinForms, MFC, HTML) but is new to WPF. In particular, the book focuses on using WPF with Visual Studio 2008, which we believe is the primary tool that most WPF developers will use, although we still spend some time talking about other available tools.
Throughout the book, your authors have injected some measure of their twisted humor, and have been known, on occasion, to resort to irony and sarcasm. We truly love WPF, but we also try not to take anything too seriouslyand we hope that it makes reading yet another technical book just that little bit less gnaw-your-own-leg-off boring.
This book is broken down into four main parts. Part 1 is mostly about history and overviews. Chapter 1 starts this off by explaining how drawing in Windows and on the web got to where they are today, and the general way in which WPF addresses some existing problems. Chapter 2 is the first chance to get your feet wet with some simple WPF code, and also provides a guided tour of WPF-specific features of Visual Studio 2008. Chapter 3 provides a reasonably detailed look at what WPF is made of, as well as various surrounding technologies and acronyms that are likely to cross your path.
Part 2 covers the core concepts and technologies of WPF, primarily through an extremely brilliantly thought-out example application (OK, OK, a calculator). Chapter 4 is all about layouts and the general laying out of content in WPF. In chapter 5, we introduce the most complex of the layoutsthe Gridand use it to rough in the calculator example. Chapter 6 demonstrates how to control the look of an application via the use of resources, control templates, and themes. In chapter 7, we cover the new eventing model of WPF. Finally, in chapter 8, we pull out all the stops to make the calculator sexy and demonstrate some of the hotness that is WPF.
Part 3 focuses on building real-world applications. In chapter 9, we show how to build the framework for a complex application, including menus and toolbars. Chapter 10 demonstrates WPF command routing. Chapter 11 shows how to hook up data to WPF applications via data binding, including pulling data from databases, XML, or objects in general. Chapter 12 continues the binding conversation with more advanced types of binding and with the use of data templates to control the way data is handled. We also explain the new Model-View-ViewModel pattern.
Chapter 13 is about building custom controls in WPFeither one-off combinations of controls, or standalone controls designed to be distributed. In chapter 14, we demonstrate various ways of doing drawing in WPF, and in chapter 15, the last chapter of part 3, we extend that to the third dimension.
Part 4 covers some additional topics likely to be relevant to developing WPF apps. Chapter 16 demonstrates building navigation applicationsapps with back/forward and hyperlinking support, which is built into WPF. In chapter 17, we take the navigation application and demonstrate how it can be hosted inside a browser via the use of XBAP. We also demonstrate ClickOnce deployment with a WPF application and touch (briefly) on Silverlighta third way in which WPF can take to the web.
Chapter 18 is all about printing and documents. WPF has extensive support for printing and for transferring content around via XPS. In chapter 19, we take a break from the boring stuff and demonstrate how to add slick transitions to your applications. We also talk a fair amount about designing an application to support effects. Chapter 20 is about using other stuff with WPF, such as Windows Forms and WPF, and using WPF with Windows Forms. Finally, chapter 21 covers threading, including the new WPF Dispatcher, and timers.
Throughout the text, weve also sprinkled various tips and nags on WPF, UI design, and whatever else we felt like at the time. The book is generally designed to be read from start to finish, but you can certainly jump around to different topics and use the various chapters for reference as needed.
This book contains a number of examples written in C# and/or in XAML. Although we did most of the work using the Professional version of Visual Studio 2008, you can do almost everything here using Visual Studio 2008 Express, which can be downloaded for free from Microsoft at www.microsoft.com/express. Weve tried to indicate when particular capabilities require one of the for-money versions. All the source code for the book (and a few additional examples) can be downloaded from www.manning.com/WPFinAction or from our blog at www.exotribe.com.
The following conventions are used throughout the book:
The purchase of WPF in Action with Visual Studio 2008 includes free access to a private forum run by Manning Publications where you can make comments about the book, ask technical questions, and receive help from the authors and other users. You can access and subscribe to the forum at www.manning.com/WPFinAction. This page provides information on how to get on the forum once you are registered, what kind of help is available, and the rules of conduct in the forum.
Mannings commitment to our readers is to provide a venue where a meaningful dialogue among individual readers and between readers and authors can take place. It isnt a commitment to any specific amount of participation on the part of the authors, whose contributions to the books forum remain voluntary (and unpaid). We suggest you try asking the authors some challenging questions, lest their interests stray!
The Author Online forum and the archives of previous discussions will be accessible from the publishers website as long as the book is in print.
There are a number of good WPF resources out on the web, including:
Arlen Feldman has been developing software professionally for over 20 years, and has been a Windows developer for the last 14. He was chief architect for the award-winning HEAT software product, and has been working with .NET since its earliest days, including working with Microsoft on the direction of .NET, the C# language, and Visual Studio, as a member of the C# customer council. Arlen specializes in architecting and building metadata-driven applications, particularly focusing on the usability issues of such systems. Because of an accident involving rogue metadata retrieval, his brain is now a five-dimensional hyper-cube.
Arlen is the author of ADO.NET Programming (Manning, 2003), and is currently the Chief Architect for Cherwell Software, builders of .NET-based support solutions. He lives in Colorado Springs, Colorado.
Maxx Daymon learned BASIC (on a Commodore VIC-20) before he learned English. His extremely eclectic background has given him experience with virtually every type of personal computer and a whole host of different industries; hes considered an expert in the back-end to the front-end of application design. To say that hes somewhat obsessed with human factors engineering would be like saying that Ghengis Kahn kind of liked fuzzy hats.
Maxx is MCPD Certified for both Windows and web development, and has been working with .NET since its preview releases. Maxx is currently a Software Architect at Configuresoft, a leading developer of configuration-management and compliance software.
By combining introductions, overviews, and how-to examples, the In Action books are designed to help learning and remembering. According to research in cognitive science, the things people remember are things they discover during self-motivated exploration.
Although no one at Manning is a cognitive scientist, were convinced that, for learning to become permanent, it must pass through stages of exploration, play, and, interestingly, retelling of what is being learned. People understand and remember new things, which is to say they master them, only after actively exploring them. Humans learn in action. An essential part of an In Action book is that its example-driven. It encourages the reader to try things out, to play with new code, and explore new ideas.
There is another, more mundane, reason for the title of this book: our readers are busy. They use books to do a job or solve a problem. They need books that allow them to jump in and jump out easily and learn just what they want just when they want it. They need books that aid them in action. The books in this series are designed for such readers.