RSS Feed
Download our iPhone app
Browse DevX
Sign up for e-mail newsletters from DevX


An Overview of Windows Presentation Foundation

Among the numerous new technologies in Vista is the Windows Presentation Foundation (WPF, formerly codenamed Avalon). This article takes you on a whirlwind tour of WPF and shows how you can start preparing for Vista by developing applications today using the available SDK.

indows Presentation Foundation (WPF) is the new graphics subsystem in Windows Vista that will enable developers to build applications that provide breakthrough user experiences. If you look at the applications in use today, they are either Windows applications or Web applications. While Windows applications offer immensely rich client functionality, deploying Windows applications requires considerable resources and makes maintenance a constant challenge. On the other hand, Web applications offers ease of deployment and maintenance, but do so at the expense of increased complexity in the development process (since the Web is stateless) as well as less-than-ideal platform integration.

Microsoft's goal when they created WPF was to offer a development platform that offers the best of both worlds, allowing administrators to deploy and manage applications securely.

While application development technologies have evolved rapidly, hardware advances have also been moving at a rapid rate. In particular, the processing power of video cards has been improving at a much more rapid rate than developers can make use of. Increasingly, computers are equipped with an over-powered graphics subsystem that is under utilized. Applications could jolly well take advantage of the power of these graphics cards (such as for three-dimensional (3-D) processing) to enhance the user experience.

And this is exactly the aim of WPF—that is, to take advantage of the under-utilized power of the video card and use it to enhance the user experience of Windows applications. WPF uses Direct3D for vector-based rendering, enabling applications to incorporate a wide assortment of media such as 2-D, 3-D, audio, text, video, animation, etc.

Installation Procedures
You can try WPF today on Windows XP or Windows Server 2003. To do so, you need to download install the following components:

It is the goal of WPF to offer a development platform that offers the best of both worlds, allowing administrators to deploy and manage applications securely.
  1. Download and install the WinFX SDK. The download contains documentation, samples, and tools designed to help you develop managed applications and libraries using WinFX.
  2. Install the WinFX Runtime Components. This download contains the WinFX Runtime components necessary to run WPF applications.
  3. Install the Visual Studio Extensions for WinFX. This download provides IntelliSense support, project templates, and documentation integration for WinFX in Visual Studio 2005.
Building User Interfaces Using XAML
In WPF, Microsoft introduces a new language for creating WPF applications—XAML (Extensible Application Markup Language). Using XAML, developers can create UIs declaratively using XML elements and attributes. This provides for a clean separation of application logic and the UI of the application, allowing interface designers to use external tools (more on this later) to design the UI and then wire them up with the code-behind files using .NET languages.

Using XAMLPad
To get developers started with XAML, Microsoft provides a useful tool known as XAMLPad. XAMLPad is a XAML editor that allows you to quickly preview your UI. To use XAMLPad, go to Start—>Programs—> Microsoft Windows SDK, then choose Tools, and finally choose XAMLPad. Figure 1 shows the various components in XAMLPad.

Figure 1: The various components in XAMLPad.
XAMLPad offers the following functions:

  1. Auto Parse—The Preview Pane (7) will be updated as you type your XAML code in (8)
  2. Refresh—Refreshes the Preview Pane (7)
  3. Changes the font in the Code Edit Pane (8)
  4. Changes the font size in the Code Edit Pane (8)
  5. Hides the Code Edit Pane (8)
  6. Changes the scaling factor of the Preview Pane (7)
  7. Preview Pane
  8. Code Edit Pane
  9. Status bar
To see XAMLPad in action, let's populate the Edit Pane with the XAML code shown below.

   <Canvas xmlns=
     Background="Ivory" LayoutTransform="scale 1">
     Canvas.Top="10" Canvas.Left="10" 
     BorderBrush="Crimson" BorderThickness="1">
     Image Source
Figure 2: Using XAMLPad to preview XAML code.
</Label> <TextBox Canvas.Top="40" Canvas.Left="10" > </TextBox> <Button Canvas.Top="40" Canvas.Left="120" Height="25">OK</Button> <Image Width="400" Canvas.Top="75" Canvas.Left="10" > <Image.Source> <BitmapImage UriSource="C:\Sunset.jpg" /> </Image.Source> </Image> </Canvas>

Figure 2 shows the resulting UI. Notice that the XAML code looks like HTML as all UI controls are defined declaratively.

Close Icon
Thanks for your registration, follow us on our social networks to keep up-to-date