DEV Community

loading...

The signs of WPF currently being on life support

Andrew Nosenko
Dad, self-employed, problem solver at heart, async all the way down. Ex principal software engineer at Nuance Communications. Occasionally I tweet and answer my own questions on StackOverflow.
・4 min read

I currently take part in a discussion about whether or not to choose WPF as a framework for a new "greenfield" Windows-only application. The application itself isn't expected to have sophisticated UI, but it might be required to use WebView2 and/or some 3rd party controls for document rendering, and viewing and printing.

I'm writing this post as someone with substantial .NET and WPF background, who has a lot of fond memories about WPF (and some bitter ones, too). I am not trying diminish the value of this framework, but rather to evaluate where it stands nowadays in Microsoft Desktop development roadmap.

From what I could tell today, even Windows Forms is getting more love from Microsoft, than WPF. I hope I'm wrong, but I'm observing the following sings of WPF being currently either shelved or in a very low maintenance support mode:

I'd expect WPF to be an ultimate container for WebView2, but so far, this doesn't seem to be the case, either:


For Microsoft itself, the future path for Windows-only app development appears to be Win UI 3. It was in a spotlight during Build 2021 and the recent Windows 11 presentation event.

Microsoft is also big about WebView2 for the apps where HTML UI is shared between Web and Desktop. Teams 2.0 is a good example of such approach, it's a thin Win UI host for WebView2. I rambled with some more details about it.

Apparently, they're are also seriously investing into React Native for Windows and Fluent UI framework.

For .NET folks who want to stick with C# for sharing HTML UI between Web and Desktop (with little or no JavaScript/React/etc), Microsoft will be releasing BlazorWebView, supported on WinForms, WPF and .NET MAUI:

Using Blazor and a hybrid approach you can start decoupling your UI investments from WPF & Windows Forms. This is a great way to modernize existing desktop apps in a way that can be brought forward onto .NET MAUI or used on the web. You can use Blazor to modernize your existing Windows Forms and WPF apps while leveraging your existing .NET investments.

This sounds like a .NET version of Electron on asteroids to me. Definitely not something I'd like to take for a ride with a new Desktop project, unless there is already a working Blazor SPA web app, to wrap as a desktop app.

There's a whole array of other options to choose from for Windows desktop development, including some cross-platform options (visit crossplatform.dev for a great concise overview).

A .NET developer can choose from WinForms, WPF, UWP, Win UI, Xamarin/MAUI .NET, Uno Platform and Avalonia.

Back to our specific app case I mentioned at the beginning... it may sound odd, but I'd personally vote for Windows Forms, which:

  • is old and battle-tested but still being actively maintained;
  • has a simple, unopinionated and well-know API;
  • uses native Win32 UI controls under the hood, and thus ...
  • ... is easier to integrate with other native or managed controls, including WebView2 and the upcoming Win UI XML Islands. I'd expect fewer issues with the focus/keyboard interop too, or at least they should be easier to address, than with WPF.

Discussion (0)