What WPF Is and Isn't
What You'll Learn in This Hour:
- What WPF is
- When you should use WPF
- What tools you will need
- How WPF compares to other frameworks
- The versions of .NET
- Silverlight
What Is WPF?
WPF is big. In fact, it can be overwhelming because it has lots of moving parts that all interconnect. The shortest answer to the question, though, is that WPF is an API for building graphical user interfaces (UI) for desktop applications with the .NET Framework.
Now for the longer answer.
To begin with, WPF is an abbreviation for Windows Presentation Foundation. Physically, it's a set of .NET assemblies and supporting tools. It's intended to provide a unified API for creating rich, sophisticated user interfaces on Windows XP and Windows Vista.
WPF combines the good things from web development, such as style sheets and a markup language for declarative UI, with good things from Rich Internet Applications, such as scalable vector graphics, animation, and media support. These good things are wrapped up with the good things from traditional Windows development—things like strong integration with the OS and data binding. In WPF, these concepts are strengthened and unified. Even all that does not capture the full extent of WPF. It has other facets, such as support for 3D drawing, advanced typography, and portable documents similar to PDF.
WPF is also a unified API. Many of the things you are able to do in WPF, you could do before. However, doing them all in one application was extremely difficult. Not only does WPF enable you to bring these disparate features together, but it provides you with a consistent API for doing so.
WPF is just one part of a larger picture. Three additional libraries were also released as part of .NET 3.0. All four of these libraries have the same intent of providing a consistent, unified API for their domain. Additionally, combining any of these four libraries in an application can yield some very impressive results. The three sibling libraries of WPF are shown in Table 1.1.
Table 1.1. The Sibling Libraries of WPF
WCF |
Windows Communication Foundation is focused on messaging. This API greatly simplifies all sorts of networking and communication tasks. It covers everything from web services to remoting to P2P and more. |
WF |
A powerful library for building workflow enabled applications. It utilizes a markup language for declaring workflows in an application, and thus prevents workflow from becoming hard-coded. It also makes it very easy for developers to create custom workflow tasks. |
CardSpace |
The least famous of the four libraries, CardSpace provides a common identification system that can be used by desktop applications, web sites, and more. |
The immediate predecessor to WPF is Windows Forms, the graphical API available to developers in .NET 2.0 and earlier. Windows Forms provides a managed wrapper for accessing the graphical functions of the traditional Windows API. WPF differs fundamentally in that it builds on top of DirectX. The DirectX API was originally focused on multimedia and game programming in particular. As such, you are able to do some nifty visual tricks in WPF that were practically impossible with Windows Forms. It also means that WPF will take advantage of hardware acceleration when it is available.
WPF still has some similarities to Windows Forms (and even ASP.NET Web Forms). Microsoft provides a library of basic controls such as text boxes and buttons. You'll also encounter familiar concepts such as data binding and code-behind files. All these concepts have been refined and improved for WPF.