Which is better WPF or Windows Forms

Windows Forms is alive!

Surprisingly, Microsoft is not simply offering the old Windows Forms in the new .NET world, but is actively working on further development. What does that mean for .NET developers?

Windows Forms is the original desktop UI library in .NET, which was introduced in the .NET Framework 1.0 in 2001 and received a great deal of enhancement in .NET 2.0 in 2005.

13 years of downtime

When it was introduced in the Windows Presentation Foundation (WPF) in 2006, Windows Forms was sidelined and, with the exception of minor improvements, particularly in the area of ​​high-DPI support and accessibility (see Development of .NET 4.5 to 4.8), no further development was made.

In .NET Core 1.0 to 2.2, Windows Forms (as well as WPF) was not included. For .NET Core 3.0 (released in September 2019) Microsoft then adopted WPF and Windows Forms into the new .NET world (but not platform-neutral, only on Windows). Therefore, both GUI frameworks are also included in .NET 5.0 (and its future successors .NET 6.0, 7.0, etc.). A usable designer for Windows Forms in .NET Core / .NET 5.0 projects is still in the preview stage in Visual Studio 2019 v16.8 from November 2020. You may have to use the crutch to design the interfaces in a classic .NET framework project and to link the result to the new project.

New features since .NET Core 3.0

Surprisingly, Microsoft is not simply offering the old Windows Forms in the new .NET world, but is actively working on further development: In .NET Core 3.0 there was only a small improvement that the high-DPI setting can not only be set via configuration file, but can also be set in the program code via API. In .NET 5.0, however, several noteworthy improvements for Windows Forms are built directly:

  • new control element: TaskDialog (a much more flexible variant of a message box).
  • The ListView control now offers a collapsible group.
  • FileDialog can have several states in an application through ClientGuid.
  • significant performance improvements when rendering some controls.
  • UI automation improvements.

It has to be mentioned that the improvements to the controls did not come from Microsoft developers themselves, but were pull requests from the user community that Microsoft included in the official release.

It should also not be overlooked that some smaller features are missing in the .NET Core and .NET 5 implementation of Windows Forms and that there was another major setback in November 2019 when Microsoft introduced some older Windows in .NET Core 3.1 -Forms controls that were included in .NET Core 3.0.

What does Microsoft want to tell us?

There have been discussions in the .NET user community about Windows Forms versus WPF for many years. Some software providers have switched their interfaces to the graphically more powerful WPF (at MAXIMAGO we have been creating .NET applications exclusively with WPF for years, since our requirements for the user experience with Windows Forms are much more complex to implement), but other software providers are doing this supposedly simpler Windows Forms remained - and there are quite a few companies. For years, third-party providers have been delivering new controls for Windows Forms and thus keeping the old GUI framework alive. Microsoft has also recognized the continuing demand for Windows Forms and is therefore offering this group of customers incentives to switch to the modern .NET 5.0 world.

For WPF there are no significant improvements in .NET Core 3.0 / 3.1 and .NET 5.0 apart from a few bug fixes. Does that mean Microsoft is recommending that developers work with Windows Forms again? No certainly not. I see it this way: Windows Forms has a lot of catching up to do because it is a very old architecture and lay idle for many years.

Future of WinUI3?

From Microsoft's point of view, the GUI framework of the future is neither Windows Forms nor WPF, but the Windows UI Library 3 (WinUI3). The GUI library WinUI 3.0 is the successor to the Universal Windows Platform (UWP) with WinUI2, the new name introduced in Windows 10 for the "Modern Apps". While UWP is based solely on the WinRT API and therefore cannot use all functions of the operating system and all local resources, a WinUI-3-based application can optionally use WinRT and / or Win32. This means that you have all the options of the Windows operating system at your disposal.

Whether WinUI3 will be better accepted by customers than UWP remains to be seen when WinUI3 is released (originally announced for 2020, now for 2021). Because one thing is already clear today: The switch from WPF to WinUI3 means some effort - but it is significantly less than the effort to switch from Windows Forms to WPF or WinUI3, because WinUI3 also uses XAML as the GUI description language like WPF, but it does are some differences.

Holger Schwichtenberg

Dr. Holger Schwichtenberg is Chief Technology Expert at MAXIMAGO, which offers innovation and experience-driven software development, including in highly critical security-related areas. He is also head of the expert network www.IT-Visions.de, which, with 38 renowned experts, supports numerous medium-sized and large companies with advice and training in the development and operation of software.

Read CV »