Have you ever thought that behind most applications on Windows common Microsoft desktop development technologies used for developing them? Probably not, because you are not the developer, but the end-user or weren't thinking about it. And that is ok! It is a developer’s task to build and develop a system, or application, or program that suites the needs, helps you to perform your daily tasks, and focus exactly on the work and less on the tool you use for it.
Development in Microsoft-centric desktop environment is plenty to pick from when it comes to complexity and support in using .NET desktop frameworks. Yet all depends on the needs and preferences because there are technologies to choose from. But each individual one has its strengths and weaknesses, good and bad, yin and yang.
The Big 4 Today
When it comes to the choice nowadays, usually there are proven and accepted ways to follow. For desktop development from Microsoft these frameworks would be – WinForms, WPF or UWP, and WinUI. Each one has its own history and complexity of development or support. But all mentioned are in the industry and are a backbone of the desktop software. Keep in mind, it`s not about WEB applications, so various frameworks are not taken into consideration.
A framework introduced together with .NET 1.0 framework and used widely even nowadays. Applications built on WinForms have somewhat ‘traditional’ look and feel, and include many control elements like buttons, text boxes, menus or etc.
Why would you pick the oldest one (first seen light in year 2002) for developing anything today? It`s simple:
- Good for fast development because technology is not very complex and is easy to learn.
- Uses drag-and-drop, has adjustable properties, the application can be coded under the interactable elements and will support almost any desirable code to do exactly what you expect from it.
- Is supported by latest .NET versions.
The drawbacks, however, are there as well:
- Primitive interface and scalability of the elements in the application window is not the best per latest UX/UI standards, as well as for modern touch and high DPI (dots per inch) displays.
- Data is tied to form or element properties, and to do something with that, you must press something or do something in the form to change focus.
- And form designer itself tends to perform with some issues which may result in loss of work done (remember to save more often).
- This is by far best one, only if you need to have a simple, yet effective application to build. It may look simply but may pack a punch and will do the job. But don`t expect it to be a Swiss army knife, it lacks some up-to-date polish. Despite that, there is popular software built on it, some worth to mention: Paint.NET, Notepad++ and KeePass.
Another popular framework introduced with .NET Framework 3.0. I would say the most robust, well documented and known by the developer community, and it will run on any modern system. It is using XAML (Extensible Application Markup Language) which is used to define user interface that became scalable, and it made applications more eye-catchy and interactive. As well as Model Views View Models (MVVM) introduced better approach to handle the data objects (model) from the UI (View) to the underlayer for code (ViewModel) to perform any necessary manipulations with the data, or handle events or etc. WPF came as a successor for WinForms, and managed to bring in the good parts:
- AML for modern looks.
- Rich data binding and MVVM architecture support.
- Powerful graphics and multimedia support.
- Cross-platform support via .NET Core.
Sounds nice? Yes! But there is a catch:
- Steep learning curve compared to WinForms due to introduced XAML and MVVM.
- Slower development time compared to WinForms.
- Not low-end hardware friendly, as well as some limitation for touch and gesture support.
The good part is, that once you struggle through all the hard bits, you have a nice and responsive application, which can do much and even more if needed! A software worth mentioning that is built on the framework: Visual Studio IDE, SourceTree and SketchFlow.
UWP, or Universal Windows Platform, is a newer framework introduced with Windows 10. As Microsoft software design evolved over the years, the desktop development advanced along and was and this framework was made to create and run on any Windows device, including desktops, laptops, tablets, and smartphones. Introducing more complex security measures, performance improvements, and the best part, it evolved from WPF. To put it simple, if you were good in WPF, you are probably somewhat easy to pick up UWP framework. The application developed in UWP will run in a virtual sandbox, there is more control now on how it will perform and not harm system files or have unnecessary permissions. It will also run in that fancy windows interface, which is fast and responsive compared to older versions.
- Access to Windows 10 introduced APIs and features.
- UWP applications work by running in a virtual sandbox, so they do not interfere with other applications and have more control.
- WPF successor, so technology is easier to adapt since same base principles are used.
- Universal application platform that supports all new Windows 10 devices or later.
- Modern and responsive user interface design.
- Good support for touch and gesture inputs.
- Built-in support for app distribution through the Microsoft Store.
And some cons:
- New Framework support is only available from Windows 10 or later.
- With new virtual sandbox introduction comes stricter access control, which must be accounted for when UWP application is developed.
- Limited support for customization and styling options.
- Limited third-party control libraries compared to WinForms and WPF.
- Many popular applications out there are Microsoft built-in windows applications that came with Windows 10, other are mostly converted to be UWP ones. Honourable mentions - Microsoft Photos, Microsoft Edge, Windows Maps.
WinUI, or Windows UI, is the youngest one. Introduced in 2018. It can be used with any programming language that supports UWP, including C#, C++, and Rust. It does include set of pre-built controls and styles and even supports some custom theming and styling. Framework was designed to be lightweight and modular, to be easier to update and to be faster to develop.
- Modern and fluent user interface design.
- Lightweight and modular architecture.
- Good support for customization and styling options.
- Good cross-platform support through .NET Core.
- Limited support for complex user interface layouts and custom controls, because was never meant for it.
- Currently lacks some features compared to other frameworks.
- Same as UWP, limited third-party control libraries compared to WinForms and WPF.
Software that we know, and use built using the framework - Microsoft Teams, Windows Terminal, Windows Calculator, Microsoft PowerToys.
In summary, WinForms is a simple and traditional framework, WPF is a more modern and visually appealing framework, UWP is designed to create applications that run on any modern Windows device, and WinUI is a new framework that provides a modern and fluent user interface for Windows applications. Each framework has its own strengths and weaknesses, and the choice of framework depends on the specific needs of the application being developed. Overall, there is no bad technology or framework, but there are nuances in picking one. After all, these frameworks are not the only ones out there, and maybe are not exactly suitable for your needs. Nowadays web applications can do the same job as desktop counterparts, but sometimes you just must go for it and create it as a desktop application.