Special Offer: My C#/.NET Bootcamp Course is out now. Get 10% OFF using the code FRIENDS10.

Windows Presentation Foundation (WPF) has been released as part of the .NET framework 3.0 in 2006. It was one year before Apple released its iPhone. Many .NET Framework versions later, it got improved, and it’s still there. In 2019, WPF is in its 13th year which raises the question if WPF is still a good choice?

What is WPF?

Windows Presentation Foundation (WPF) is a UI framework for building Windows desktop applications. It uses the Extensible Application Markup Language (XAML) to define views in a declarative way. It has built-in support for resources, graphics, data binding and much more. It’s a very feature rich UI framework.

WPF is open source

On December 4th, 2018 Scott Hanselman announced on his blog that WPF, WinForms, and WinUI are being open-sourced by Microsoft on the same day as .NET Core 3.0 Preview 1 was announced.

Open sourcing means that the community has the option to contribute features and bugfixes to the technology. Microsoft has proved that they care about open source and open sourcing WPF is a strong sign that Microsoft also cares about the future for WPF.

It is worth mentioning that Microsoft did not publish the sources of the existing WPF implementation to GitHub, but they reacted a repository called WPF for .NET Core, which indicates that it’s a specific code base targeting the .NET Core platform.

Microsoft Roadmap 2019

Microsoft’s official 2019 WPF roadmap states that functional and performance parity compared to the .NET Framework are set goals in regards to the release of .NET Core 3.0.

The roadmap also states that there needs work to be done in order to have all components available and that they are working on the process of how to validate and merge community pull requests.

The impact of .NET core

With the upcoming release of .NET Core 3.0 Microsoft adds WPF support to the new generation of .NET. That also gives you the opportunity to ship a specific version of the .NET (Core) framework with your application instead of relying on a specific version installed on your customer’s machines.

It is a big statement from Microsoft to move WPF to .NET core. In my opinion, this move shows that Microsoft continues to believe in the future of WPF as a UI framework for the .NET platform. They invest a lot of money into open-sourcing it and making it run on .NET core.

One of the biggest benefits of this move is that you are no longer boxed into the (full) .NET framework if you want to build a WPF application. You now have the same choice for front-end products that backend developers already had since .NET core 1.0. You can now choose if you want to write your application for the new or the established platform. Having a choice is great.

Because WPF (and WinForms) use a lot of Windows-specific features, WPF applications will only run on Windows. It’s also true for WPF applications targeting the .NET core platform. That is somewhat unintuitive because .NET core is best known as a cross-platform framework, but makes sense if you think about the history of WPF.

What about existing applications?

Do we have to migrate existing applications to .NET Core? No, we don’t, but we can. Microsoft suggests that new projects should be considered building on the new .NET Core platform where existing legacy apps which are in maintenance mode and are not business critical can remain on .NET Framework. The (full) .NET framework will still be available for a long time.

Advantages of .NET Core for Desktop

1. Your application runs on the newest .NET technology which was written from scratch resulting in a much better performance. Some of the legacy stuff from the early days that could not be removed from the (full) .NET Framework were not transferred to the .NET Core platform. All of this makes it much more efficient.

2. You can run your applications side-by-side using different .NET Core versions. That allows your application to be independent of the .NET frameworks installed on your computer or your customer’s computer.

3. You gain access to the newest features in Visual Studio around the new project file format, tools and SDKs which were created for applications using the .NET Core platform.

4. Building your application becomes faster which results in less effort (time & money spent). That is especially helpful in regards to continuous integration and continuous delivery.

From the .NET blog:
“Know that if you have existing .NET Framework apps that there is no pressure to port them to .NET Core. We will be adding features to .NET Framework 4.8 to support new desktop scenarios. While we do recommend that new desktop apps should consider targeting .NET Core, the .NET Framework will keep the high compatibility bar and will provide support for your apps for a very long time to come.”

Alternatives

Not in the scope of this article, but also worth mentioning is that there are community created alternatives for the .NET Core platform:

  • Platform Uno allows you to write C# and XAML code to build web and mobile applications targeting Android and iOS. It also provides a Universal Windows Platform (UWP) bridge.
  • Avalonia is a cross-platform XAML framework for .NET Framework, .NET Core and Mono. As it supports .NET Core and Mono it runs not only on Windows but also on Linux. It also features experimental mobile support for Android and iOS.

Of course, there are other projects including Blazor and Ooui which leverage your C# and .NET skills to build applications for the web.

Conclusion

In my opinion, WPF is still a valuable and relevant framework for building .NET applications in 2019 for both the .NET Framework and for .NET Core. If you have a team or company familiar with the tools why shouldn’t you use this advantage? Use something new, just because it’s shiny? Does not make any sense for me.

If I was in the situation where I have existing applications I would carefully evaluate for each application if migrating to .NET Core makes sense and how much effort it would take to do so. As explained in this article, there are many benefits of running on the .NET Core platform which you could leverage for your application.

One important aspect is that there is a big eco-system around WPF. There are UI frameworks like Telerik or DevExpress which enhance the functionality even further. There are also MVVM frameworks which help you decouple view logic and business logic.

And because WPF is around for a long time, it can be considered stable. There won’t be breaking changes in every further release, and there won’t be silly bugs in commonly used components.

It depends on the requirements of a new project if WPF is an option. When it comes to a Windows (only) Desktop client, WPF can still be a viable option.

The alternatives mentioned above give us many different options to choose from. There is still a very healthy eco-system around Windows Desktop application development, although web and mobile are going through the roof.

Further Resources

 

Claudio Bernasconi

I'm an enthusiastic Software Engineer with a passion for teaching .NET development on YouTube, writing articles about my journey on my blog, and making people smile.