Windows optimize

Windows Presentation Foundation: Another piece of the .NET puzzle

Windows Presentation Foundation (WPF) is a framework that is available under the .NET Framework umbrella beginning with version 3.0. A main benefit of WPF is the promise of a common application base for both Windows and Web applications.

The .NET Framework is growing so much that I'm unable to be proficient in all areas, but I still need to be aware of all of its features. For that reason, I am examining .NET 3.0's Windows Presentation Foundation (WPF) for its application and usage.

One piece of the puzzle

WPF is just one of the major enhancements to the .NET Framework introduced alongside Windows Vista. Along with WPF, there is Windows Communication Foundation (WCF), Windows Workflow Foundation (WWF), and InfoCard. They provide all the pieces for building solid applications with .NET at the core.

What is WPF?

There is so much power in the .NET Framework that you may wonder why something like WPF is necessary. It is important to understand the goal of WPF before jumping to any conclusions.

WPF is a common programming model for standalone and browser UIs. It is Microsoft's unified presentation platform for creating rich UIs. WPF is not a replacement for Windows Forms, AJAX, or Silverlight -- it is designed to work in tandem with such technologies to build rich UIs.

Microsoft describes WPF as the next-generation Windows smart-client UI technology. WPF includes the following features:

  • Immersive desktop applications: It includes rich ISV and LOB applications that you can deploy to Windows as a standalone client.
  • Enterprise intranet applications: You may use the same code base to deploy a WPF application either as a standalone desktop client or in the browser. The key feature of this approach is the need to maintain one code base for enterprise applications that are needed in both deployment models.
  • Windows Media Center applications: WPF provides a sophisticated visual toolbox to create a great user experience that scales to different form factors from CRT monitors to laptop LCDs to big screen televisions. End users who use Media Center Extender can also navigate with their remote controls.
  • Premium Internet applications: WPF provides a great platform for building rich Internet applications through its many features like XAML Browser Applications, UI and media integration, document services/styling, and data binding. (Data binding is the process of establishing a connection between the application UI and business logic.)

Development tools

A key feature of WPF is that you use existing tools to put WPF into action; this includes Visual Studio for developers and something like Microsoft Expression for designers. The key component introduced with WPF and .NET 3.0 is Extensible Application Markup Language (XAML).

XAML (pronounced as "Zammel") is the XML-based markup language that works with the new graphic subsystem (WPF) delivered with Microsoft Vista and .NET 3.0. XAML allows both developers and designers to work with WPF functionality. It separates code from the content and may be rendered in a browser or in a standalone application. It provides an XML-based way to declaratively specify a hierarchy of objects with properties and logic.

XAML is generated by the designer and consumed by the developer and vice versa. That is, the workflow is now two-way, meaning that the development process can also start with XAML created by the developer and delivered to a designer. The designer styles or redesigns the interface via XAML.

XAML is an XML derivative, so developers and designers may use their favorite text editor or preferred tools like Visual Studio to work with the XAML source. This means developers and designers can concentrate on learning XAML and its syntax while sticking with familiar tools.

As far as features, WPF provides a vast array of controls and design elements for building rich UIs. The following list provides an overview of some of these features:

  • Controls: WPF provides a rich set of controls that includes Border, BulletDecorator, Button, Canvas, CheckBox, ComboBox, ContextMenu, Control, DockPanel, DocumentViewer, and much more.
  • Layout: WPF elements may be positioned within a window via different layout panels including Canvas, DockPanel, StackPanel, Grid, and WrapPanel.
  • Styles and resources: Styles centrally define the appearance and interactive behaviors of elements. A resource is an object defined within a WPF application for the purpose of reusing a resource.
  • Events: You can use timelines, triggers, and animation to incorporate such features within a WPF application. For example, you can define actions for responding to user mouse events.

Getting WPF

WPF works on Windows Vista, Windows XP, and Windows Server 2003. It is licensed as a part of Windows, so there is no additional charge for WPF.

Online resources

There is an abundance of good resources available for you to learn more about WPF, including WindowsClient.net and the .NET Framework Developer Center. A great tool for becoming familiar with XAML is XAML Cruncher; it allows you to interactively type XAML code and see the results.

More functionality

WPF offers a new paradigm in building UIs with Microsoft technologies. One of the main benefits is the promise of a common application base for both Windows and Web applications.

What is your experience with the latest iteration of the .NET Framework? Have you used or tested the new technologies like WCF and WPF? Share your experience and thoughts with the .NET community.

Tony Patton began his professional career as an application developer earning Java, VB, Lotus, and XML certifications to bolster his knowledge.

---------------------------------------------------------------------------------------

Get weekly .NET tips in your inbox TechRepublic's free .NET newsletter, delivered each Wednesday, contains useful tips and coding examples on topics such as Web services, ASP.NET, ADO.NET, and Visual Studio .NET. Automatically subscribe today!

About

Tony Patton has worn many hats over his 15+ years in the IT industry while witnessing many technologies come and go. He currently focuses on .NET and Web Development while trying to grasp the many facets of supporting such technologies in a productio...

6 comments
MadestroITSolutions
MadestroITSolutions

I like the article. I would like to know more about this, such as a practical example or walkthrough with some code snippets.

Underground_In_TN
Underground_In_TN

You were doing so well, defining your acronyms before you used them for WPF, WCF, WWF, XAML. Then you left me in the dark with the only acronyms I haven't seen before: ISV and LOB. Please define them. Wikipedia's definitions don't seem to match the context.

Rob Scholl
Rob Scholl

How about these from whatis.com: "An LOB (line-of-business) application is one of the set of critical computer applications that are vital to running an enterprise, such as accounting, supply chain management, and resource planning applications. LOB applications are usually large programs that contain a number of integrated capabilities and tie into databases and database management systems. Increasingly, LOB applications are being connected with network applications with user interfaces on the Web and with personal applications such as e-mail and address books. " "An ISV (independent software vendor) makes and sells software products that run on one or more computer hardware or operating system platforms"

sknabt
sknabt

I don't have a problem with this article, per se; however, there's so much on the internet describing what WPF is what's the point? That's easy. Implemention at this stage for .Net developers is hard. We got Microsoft's Expression Blend for this purpose. Impressive product for making a rich interface. Some good tutorials on MSDN for this purpose. So, you have a great UI. Now make it do something. This is where Microsoft comes up way short. For example, they have a case study video of an easy integration between Expression Blend and VS 2005 where XAML displays in the VS 2005 designer. Not in our experience. Dig around and you'll find some 3rd party tools that may or may not be any good at this. Microsoft appears to be putting this ability off until VS 2008 which won't be out until next February. XAML will likely be the next great thing for .Net developers; however, we have to make a decision if it's worth going with such an immature tool set.

sknabt
sknabt

I say I have a "problem" with the article, per se. It's a nice overview. However, there are plenty of overviews and descriptions of WPF. Another doesn't help all that much for someone like me trying to implement it. Resources on WPF for using it are pretty thin on the Internet. For example, we're starting up a new major project and, naturally, planned to use WPF for the smart client UI. We got Expression Blend for this purpose. The learning curve is steep and practical documentation beyond making pretty buttons spotty. Documentation on integrating it with VS 2005 is not to be found on MSDN that I can see. Though I've seen a neat case study video where XAML is magically being displayed in designer mode in VS 2005. Not in our experience without some 3rd party add-on. WPF for .Net developers looks like it's on hold until VS 2008 provides a native XAML designer/editor. It's only for the adventuresome right now.