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.)
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.
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.
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.
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!
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 production environment on a daily basis.