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 WPFthat 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.
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.|
Building User Interfaces Using XAML
- Download and install the WinFX SDK. The download contains documentation, samples, and tools designed to help you develop managed applications and libraries using WinFX.
- Install the WinFX Runtime Components. This download contains the WinFX Runtime components necessary to run WPF applications.
- Install the Visual Studio Extensions for WinFX. This download provides IntelliSense support, project templates, and documentation integration for WinFX in Visual Studio 2005.
In WPF, Microsoft introduces a new language for creating WPF applicationsXAML (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.
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:
- Auto ParseThe Preview Pane (7) will be updated as you type your XAML code in (8)
- RefreshRefreshes the Preview Pane (7)
- Changes the font in the Code Edit Pane (8)
- Changes the font size in the Code Edit Pane (8)
- Hides the Code Edit Pane (8)
- Changes the scaling factor of the Preview Pane (7)
- Preview Pane
- Code Edit Pane
- Status bar
To see XAMLPad in action, let's populate the Edit Pane with the XAML code shown below.
Background="Ivory" LayoutTransform="scale 1">
<TextBox Canvas.Top="40" Canvas.Left="10" >
<Button Canvas.Top="40" Canvas.Left="120"
<Image Width="400" Canvas.Top="75"
<BitmapImage UriSource="C:\Sunset.jpg" />
|Figure 2: Using XAMLPad to preview XAML code.|
shows the resulting UI. Notice that the XAML code looks like HTML as all UI controls are defined declaratively.