Understanding Windows Presentation Foundation User-Interface and Deployment Options
WEBINAR: On-demand webcast
How to Boost Database Development Productivity on Linux, Docker, and Kubernetes with Microsoft SQL Server 2017 REGISTER >
Windows Presentation Foundation (WPF) isn't simply another user interface (UI) option. WPF is a whole new UI approach that, itself, has three different options for UI deployment:
- Standalone Applications
- XAML Browser-hosted Applications (XBAP)
- Silverlight Applications (which isn't the same as XBAP)
So which one should you use? Here's a quick rundown of what's the same and what's different, aimed at making it clear what's best for your application. (I'll begin by discussing Standalone and XBAP and save Silverlight for last.)
So what are the important differences?
A Standalone Application is installed on the user's machine using an MSI file or ClickOnce. It appears in the Start menu and in the Add/Remove Programs dialog. (However, it doesn't have registry dependences and can be XCopy- deployed, as with other .NET applications.)
- An XBAP requires no initial deployment or update deployment. You simply browse to the URL and use it.
- You must be on-line to use an XBAP. Standalone applications can run without an Internet connection.
- A Standalone Application typically runs in a Full-Trust environment and therefore has full access to the .NET Framework libraries. An XBAP runs in a Partial-Trust environment that is limited. It cannot, for example, use Reflection. (In .NET 3.0, an XBAP was also restricted from using Windows Communication Foundation (WCF), .NET 3.5 lifts that restriction, while retaining Partial Trust.)
- An XBAP must run in a browser and in the browser's process. A Standalone Applications runs in its own separate window and its own process. (An XBAP in .NET 3.0 is limited to running within IE 6.0+, but .NET 3.5 supports Firefox).
That clarifies the difference between a Standalone Application and XBAP. But what about Silverlight? Silverlight is a browser plug-in that implements a subset of the .NET Framework, including a subset of the WPF libraries. This allows you to build a Web application that has a much broader reach, running on all major Linux platforms including MacOS X. The price you pay, of course, is the more limited .NET Framework implementation.
So which is right for your project? Here are the essential questions to ask:
- How difficult is standalone deployment in your environment? While WPF Standalone Applications are easier than their Windows Forms counterparts, nothing is simpler than Web application deployment.
- What's the lowest common denominator client machine configuration in your environment? Can you rely on having Windows XP+ and .NET Framework 3.0+ on every client? Or do you have a mix that includes different flavors of Linux?
- What pieces of the .NET Framework 3.0+ will your application need to leverage? And a corollary: What resources will your application need? Both XBAP's and Silverlight Applications run in Partial Trust, using a limited .NET Framework (much more limited, in the case of Silverlight).
WPF portends a bright future for application UI's. So a clear understanding of the options is critical. Now you're ready to make an informed decision for your own environment and projects.