What Is WPF (Windows Presentation Foundation) ?

what is WPF

A lot of people ask me this question, and there are many potential answers. Ill first describe what WPF is from a technical viewpoint, and then answer the broader question of how WPF fits into an ever-changing development platform landscape.

In essence though, WPF Is Microsoft’s most capable technology platform for creating powerful desktop applications for Windows XP, 7, 8 & 10.

What is WPF? -The technical viewpoint:

If you’re going to create a Desktop app that targets only Windows, and you are willing to learn C# and XAML, then WPF is still the default solution for creating that application.

WPF was launched in 2006 as a replacement for the existing Desktop platform technology of the time, called Windows Forms. Although WPF was designed as a replacement for Windows Forms (WinForms), both WPF and WinForms are still actively developed and supported to this day.
The WPF development platform supports a broad set of application development features, including an application model, resources, controls, graphics, layout, data binding, documents, and security.

Because it is built on top of the Microsoft .NET framework, it shares many of the core libraries used in ASP.Net and Windows Forms development, so developers coming from those backgrounds can readily pick up WPF development skills if they learn a little XAML.
WPF incorporates a UI description and design language called XAML, which is compatible with XML.
XAML describes the user interface visually, and is independent of the coded behavior of the user interface. This allows the developer to change the ‘look’ of an application (or application components) by simply changing or replacing the XAML description of how this should look. In fact, a WPF component (UI control) is said to be ‘look-less’, and the XAML is said to represent the component or application’s ‘skin’.

With the application’s UI (User Interface) and behavior clearly separated, there is a concept called ‘binding’ that describes how to two aspect of the component interact. XAML ‘bindings’ are based on a rich binding language that allow for some very sophisticated connectivity between the XAML UI and the underlying component functionality. In fact the XAML binding technology is a mini-language all of it’s own, and will be the topic of a future post.
Because of this clear separation between the visual appearance of an app or component, and the functionality behind it, a new User Interface design pattern was born - Model View View-Model (MVVM).

The MVVM design pattern is based around the XAML binding capabilities in WPF. This allows ‘dumb’ user interfaces to be powered by an independent ViewModel that is able to be tested without the need to spin-up and the entire WPF layout engine.
If you come from the modern web application world, then this separation of concerns via a binding language is very similar in principal to what you find in Angular and/or Reactjs components - a piece of markup (HTML/JSX) and a components associated code file (.js / .ts). However the WPF binding technology is significantly more powerful and expressive.

There are two main IDEs (Integrated Development Environments) for WPF. Development. The traditional product from Microsoft called Visual Studio, and more recently a product called ‘Ryder’ from a company called JetBrains.
Although the new Ryder product offers a slightly more nimble and light-weight development experience, it lacks the comprehensive and powerful debugger found in the Visual Studio product. It is therefore the case that the majority of WPF development is done on Microsoft own Visual Studio tools

Applications built with WPF can be deployed on any version of Windows back to Windows XP (Although today Microsoft only supports WPF on Windows 7,8,and 10). There are two main ways of deploying a WPF app - XCopy (just copy the binaries to wherever you want to run it), and ‘Click-Once’ (Install the binaries and future updates from a deployment Url).
More recently Microsoft has announced the .NET Core V3, which enables UWP technologies to be utilized inside WPF applications, effectively bringing those two technologies together.
This allows for a ‘best of both worlds’ application to be developed. With .NET Core V3 Microsoft will also make it easy to deploy WPF applications to the Microsoft app store.

WPF Technology stack
What is WPF’s place in the software development landscape in 2019?

Its no news to anyone that the majority of desktop software used today is web-based. It makes complete sense for standard workflow-based ‘Line of Business’ applications. Web applications are cheap to create and maintain, and the deployment costs are minimal.
However, there are many niches where a full-power desktop app is still the very best option. No-one disagrees with the fact that Desktop applications are more powerful and capable than applications delivered through a web browser. The canonical example of these kinds of applications include well known power-hungry design tools from Adobe, as well as computer-aided design tools from companies such as AutoDesk.

You need to also consider that desktop app development is often more expensive than developing a web-based equivalent. WPF developers are paid significantly more than Javascript/Web developers, if for no other reason than the fact that there are far fewer WPF developers on the market these days.

Having lived almost exclusively in the Desktop app world for nearly 20 years, I have seen many of my peers jump onto the Javascript app bandwagon.
It is undoubtedly a good move if your comforted by the low risks associated with following the crowd. Personally, I think this is a little short-sighted. Desktop applications aren't be going away at any time in the future, and the demand for developers with these niche skills will only rise.

WPF was supposed to be superseded by a newer XAML-based technology called ‘UWP’ (Universal Windows Platform).
However, the desktop development community has not embraced this newer platform, primarily because it is essentially a mobile-first technology, and lacks the power and capability of WPF or Windows Forms.

Microsoft’s current strategy is to attempt to combine WPF with UWP via the technology-sharing capabilities in the new .NET Core v3.
I am skeptical that this will bear any meaningful fruit, but I guess we’ll have to wait and see.

About the author

Dean Chalk

I am a freelance (contract) Microsoft WPF developer, specialising in challenging, high-performance user interface development. I have been working exclusively on enterprise WPF app development since 2006, and I have been a part of some of the most demanding WPF projects ever created withing the Investment Banking / trading industry.