Essential Windows Presentation Foundation (WPF)

  • ISBN13:


  • ISBN10:


  • Edition: 1st
  • Format: Paperback
  • Copyright: 2007-04-11
  • Publisher: Addison-Wesley Professional
  • Purchase Benefits
  • Free Shipping On Orders Over $35!
    Your order must be $35 or more to qualify for free economy shipping. Bulk sales, PO's, Marketplace items, eBooks and apparel do not qualify for this offer.
  • Get Rewarded for Ordering Your Textbooks! Enroll Now
List Price: $54.99 Save up to $8.25
  • Buy New
    Add to Cart Free Shipping


Supplemental Materials

What is included with this book?

  • The New copy of this book will include any supplemental materials advertised. Please check the title of the book to determine if it should include any access cards, study guides, lab manuals, CDs, etc.
  • The eBook copy of this book is not guaranteed to include any supplemental materials. Typically, only the book itself is included. This is true even if the title states it includes any access cards, study guides, lab manuals, CDs, etc.


"Chris Anderson was one of the chief architects of the next-generation GUI stack, the Windows Presentation Framework (WPF), which is the subject of this book. Chrisrs"s insights shine a light from the internals of WPF to those standing at the entrance, guiding you through the concepts that form the foundation of his creation." From the foreword by Chris Sells "As one of the architects behind WPF, Chris Anderson skillfully explains not only the ls"how,rs" but also the ls"why.rs" This book is an excellent resource for anyone wanting to understand the design principles and best practices of WPF." Anders Hejlsberg, technical fellow, Microsoft Corporation "If WPF stands as the user interface technology for the next generation of Windows, then Chris Anderson stands as the Charles Petzold for the next generation of Windows user interface developers." Ted Neward, founding editor, TheServerSide.NET "This is an excellent book that does a really great job of introducing you to WPF, and explaining how to unlock the tremendous potential it provides." Scott Guthrie, general manager, Developer Division, Microsoft "WPF is a whole new animal when it comes to creating UI applications, drawing on design principles originating from both Windows Forms and the Web. Chris does a great job of not only explaining how to use the new features and capabilities of WPF (with associated code and XAML based syntax), but also explains why things work the way they do. As one of the architects of WPF, Chris gives great insight into the plumbing and design principles of WPF, as well as the mechanics of writing code using it. This is truly essential if you plan to be a serious WPF developer." Brian Noyes, chief architect, IDesign Inc.; Microsoft Regional Director; Microsoft MVP "I was given the opportunity to take a look at Chris Andersonrs"s book and found it to be an exceedingly valuable resource, one I can comfortably recommend to others. I can only speak for myself, but when faced with a new technology I like to have an understanding of how it relates to and works in relation to the technology it is supplanting. Chris starts his book by tying the WPF directly into the world of Windows 32-bit UI in C++. Chris demonstrates both a keen understanding of the underlying logic that drives the WPF and how it works and also a skill in helping the reader build on their own knowledge through examples that mimic how you would build your cutting edge applications." Bill Sheldon, principal engineer, InterKnowlogy Windows Presentation Foundation (WPF) replaces Microsoftrs"s diverse presentation technologies with a unified, state-of-the-art platform for building rich applications. WPF combines the best of Windows and the Web; fully integrates user interfaces, documents, and media; and leverages the full power of XML-based declarative programming. InEssential Windows Presentation Foundation,former WPF architect Chris Anderson systematically introduces this breakthrough platform, focusing on the concepts and techniques working developers need in order to build robust applications for real users. Drawing on his unique experience as an architect on the team, Anderson thoroughly illuminates the crucial new concepts underlying WPF and reveals how its APIs work together to offer developers unprecedented value. Through working sample code, yours"ll discover how WPF draws on the Webrs"s simple models for markup and deployment, common frame for applications, and rich server connectivity, and on Windows

Author Biography

Chris Anderson, architect in Microsoft’s Connected Systems Division, specializes in designing and architecting .NET technologies for the next generation of applications and services. In ten years at Microsoft, he has worked on technologies ranging from Visual Basic 6.0 and Visual J++ 6.0 to .NET Framework 1.0 and 1.1. In 2002, he joined the Windows Client team as an architect for Windows Presentation Foundation. Anderson has spoken at numerous conferences, including PDC, TechEd, WinDev, and DevCon.

Table of Contents

Figuresp. xv
Foreword by Don Boxp. xxv
Foreword by Chris Sellsp. xxvii
Prefacep. xxix
About the Authorp. xxxix
Introductionp. 1
WPF as the New GUIp. 1
A Brief Look at the XAML Programming Modelp. 11
A Tour of WPFp. 17
Tools for Building Applicationsp. 39
Where Are We?p. 41
Applicationsp. 43
Application Principlesp. 43
Applicationp. 52
Resources and Configurationp. 60
Windowsp. 71
User Controlsp. 80
Navigation and Pagesp. 83
Hosting Applications in a Browserp. 103
Where Are We?p. 111
Controlsp. 113
Control Principlesp. 113
Control Libraryp. 128
Building Blocksp. 161
Where Are We?p. 171
Layoutp. 173
Layout Principlesp. 173
Layout Libraryp. 186
Gridp. 196
Writing a Custom Layoutp. 207
Where Are We?p. 215
Visualsp. 217
2D Graphicsp. 218
3D Graphicsp. 254
Documents and Textp. 267
Animationp. 283
Mediap. 300
Where Are We?p. 305
Datap. 307
Data Principlesp. 307
Resourcesp. 310
Binding Basicsp. 316
Binding to CLR Objectsp. 322
Binding to XMLp. 331
Data Templatesp. 338
Advanced Bindingp. 342
Data-Driven Displayp. 357
Where Are We?p. 363
Actionsp. 365
Action Principlesv365
Eventsp. 369
Commandsp. 373
Triggersp. 383
Where Are We?p. 389
Stylesp. 391
Style Principlesp. 391
Beginning Stylesp. 397
Using Styles for Good, Not Evilp. 415
Where Are We?p. 419
Appendix: Base Servicesp. 421
Threading and Dispatchersp. 421
Propertiesp. 427
Keyboards, Mice, and Stylusesp. 437
Where Are We?p. 442
Indexp. 443
Table of Contents provided by Publisher. All Rights Reserved.


Over the past nine years I have worked on many user interface (UI) projects at Microsoft. I have spent time working on Visual Basic 6.0, the version of Windows Foundation Classes that shipped with Visual J++ 6.0, Windows Forms for the .NET Framework, internal projects that never saw the light of day, and now, finally, Windows Presentation Foundation (WPF). I started working on WPF about 18 months after the team was created, joining as an architect in the fall of 2002. At that time, and until late 2005, the team and technology were code-named Avalon. Early in 2003 I had the privilege of helping to redesign the platform, which we released as a technology preview for the Professional Developers Conference (PDC) 2003 in Los Angeles. WPF is the product of almost five years of work by more than 300 people. Some of the design ideas in WPF date back to products from as early as 1997 (Application Foundation Classes for Java was the beginning of some of the ideas for creating components in WPF). When I joined the WPF team, it was still very much in research mode. The project contained many more ideas than could possibly ship in a single version. The primary goal of WPFto replace all the existing infrastructure for building applications on the client with a new integrated platform that would combine the best of Win32 and the Webwas amazingly ambitious and blurred the lines between user interface, documents, and media. Over the years we have made painful cuts, added great features, and listened to a ton of feedback from customers, but we never lost sight of that vision. A Brief History of GUI Graphical user interfaces (GUIs) started in the early 1980s in the Xerox PARC laboratory. Since then, Microsoft, Apple, and many other companies have created many platforms for producing GUI applications. Microsoft's GUI platform began with Windows 1.0 but didn't gain widespread use until Windows 3.0 was released in 1990. The primary programming model for building GUI applications consisted of the two dynamic link libraries (DLLs): User and GDI. In 1991 Microsoft released Visual Basic 1.0, which was built on top of User and GDI, and offered a much simpler programming model. Visual Basic's UI model, internally called Ruby,1was far simpler to use than were the raw Windows APIs. This simplicity angered the developers who felt that programming should be difficult. The early versions of Visual Basic were significantly limited, however, so most developers building "real" applications chose to program directly to User and GDI. Over time, that changed. By the time the Microsoft world moved to 32-bit with the release of Windows 95 and Visual Basic 4.0, the VB crowd was gaining significant momentum and was offering a much wider breadth of platform features. At about the same time there was another big shift in the market: the Internet. Microsoft had been working on a replacement for the Visual Basic UI model that was internally called Forms3.For various reasons, Microsoft decided to use this model as the basis for an offering in the browser space. The engine was renamed Tridentinternally, and today it ships in Windows asMSHTML.dll. Trident evolved over the years to be an HTML-specific engine with great text layout, markup, and scripting support. Also around the same time, another phenomenon appeared on everyone's radar: managed code. Visual Basic had been running in a managed environment for a long time (as had many other languages), but the introduction of Java by Sun Microsystems in 1994 marked the first time that many developers were exposed to the notion of a virtual machine. Over the next several years managed code became a larger and larger force in the market, and in 2002 Microsoft released its own general-purpose managed-code platform: the .NET Framework. Included in the .NET Framework was Windows Forms, a managed-code API for programming User32 and GDI+ (a successor to GDI32). Windows Forms was intended to replace the old Ruby forms package in Visual Basic. As we entered the new millennium, Microsoft had four predominant UI platforms: User32/GDI32, Ruby, Trident, and Windows Forms. These technologies solve different sets of problems, have different programming models, and are used by different sets of customers. Graphics systems had also evolved: In 1995, Microsoft introduced DirectX, a graphics system that gave the programmer much deeper access to the hardware. But none of the four main UI technologies used this newfound power in a meaningful way. There was a real problem to be solved here. Customers were demanding the richness of modern video games and television productions in their applications. Media, animation, and rich graphics should be everywhere. They wanted rich text support because almost every application displayed some type of text or documentation. They wanted rich widgets for creating applications, buttons, trees, lists, and text editorsall of which were needed to build the most basic application. With these four major platforms a large percentage of the customers' needs were met, but they were all islands. The ability to mix and match parts of the platforms was difficult and error-prone. From a purely selfish point of view, Microsoft management (well, I'll name names: Bill Gates) was tired of paying four teams to build largely overlapping technologies. In 2001, Microsoft formed a new team with a simple-sounding mission: to build a unified presentation platform that could eventually replace User32/GDI32, Ruby, Trident, and Windows Forms, while enabling the new scenarios that customers were demanding in the presentation space. The people who made up this team came largely from the existing presentation platform teams, and the goal was to produce a best-of-breed platform that could really be a quantum leap forward. And so the Avalon team was formed. At PDC 2003, Microsoft announced Avalon (the code name at the time). Later the project was given the name Windows Presentation Foundation. Principles of WPF WPF has taken a long time to build, but for the entire life of this project, several guiding principles have remained constant. Build a Platform for Rich Presentation In descriptions of new technology, richis probably one of the most overused words. However, I can't think of a better term to convey the principle behind WPF. Our goal was to create a superset of features from all existing presentation technologiesfrom basic things like vector graphics, gradients, and bitmap effects, to more advanced things like 3D, animation, media, and typography. The other key part of the principle was the word platform. The goal was to create not merely a runtime player for rich content, but rather an application platform that people could use to build large-scale applications and even extend the platform to do new things that we never envisioned. Build a Programmable Platform Early on, the WPF team decided that both a markup (declarative) and code (imperative) programming model were needed for the platform. As we looked around at the time, it became clear that developers were embracing the new managed-code environments. Quickly, the principle of a programmable platform became a principle of a managed programming model. The goal was to make managed code the native programming model of the system, not a tacked-on layer. Build a Declarative Platform From the perspective of both customers and software developers, it seemed clear that the industry was moving to a more and more declarative programming model. We knew that for WPF to be successful, we needed a rich, consistent, and complete markup-based programming model. Again, a look at what was going on in the industry made it

Rewards Program

Write a Review