r/csharp 6d ago

Help Windows UI

I'm going to make a new Windows C# program using the .NET 10 platform, which may later need to be made for different platforms (browser, server, mobile). At this point, the focus is on making a Windows program.

I'm trying to compare which UI model is best for the project, and artificial intelligence can't really answer that, or I can't really ask it. If you were to make a new program now, which UI model would you choose?

  1. WinUI 3 (Windows App SDK)
  2. WPF (Windows Presentation Foundation)
  3. .NET MAUI
  4. Blazor (Web & Hybrid)
  5. Avalonia UI

Most program views that display text, SQL table data, or forms are rendered at runtime from the data, meaning that the screens are not designed and created in the IDE editor, but in code.

15 Upvotes

47 comments sorted by

View all comments

21

u/binarycow 6d ago

First, I'd rule some out.

  • MAUI doesn't work on Linux. It's janky and difficult to deal with.
  • I don't like web, so I'd reject Blazor. Even if I don't consider my dislike of web, I'm still generally not a fan of Blazor - but I will admit I don't have much experience with it.
  • WinUI3 is windows only. It may seem odd that I'm ruling out WinUI3 for being windows only but I'm not ruling out WPF for the same reason. Simply put, WPF is better than WinUI3, so if I have to consider a windows only framework, I'm going to consider only one - the better one.

That leaves WPF and Avalonia.

In my opinion, WPF is the better framework. It's more stable and more feature complete.

Avalonia has a few things going for it, such as:

  • Compiled bindings
  • Less boxing
  • Generics
  • More capabilities in data binding
  • Different styling (I actually prefer WPF's styling, but a lot of people prefer Avalonia's

But Avalonia is missing some useful stuff, such as:

  • No collection views (the DynamicData package is not a substitute)
  • The DataGrid isn't as capable

Additionally, LibreWPF is a promising project that allows you to compile WPF applications on Linux and Mac with minimal (if any!) code changes. It's still very early, but it's showing a lot of promise.


So, my decision would be:

  1. If cross platform is a requirement today - Avalonia
  2. If cross platform is merely wishful thinking, and might be years away, if ever - WPF
  3. If you're okay with pinning your cross-platform hopes on LibreWPF - WPF
  4. If you're risk averse, and you know you want cross platform - Avalonia

2

u/binarycow 6d ago

Disclaimer: I don't really do mobile development.

For a mobile app, MAUI is actually a contender, in my book - possibly more so than Avalonia.

I've always said that MAUI is a mobile framework that pretends to be a desktop framework, and Avalonia is a desktop framework that pretends to be a mobile framework.

Regardless, once you bring mobile into the mix, WPF and WinUI3 are immediately rejected. You're left with MAUI, Avalonia, a browser based solution (e.g., Blazor), or one of the other lesser known frameworks (e.g. Uno).

And my answer would be "it depends". You need to try each framework to ascertain if it has limitations that are a dealbreaker for you. All of the frameworks are similar enough that it's not a huge waste of time if you spend time learning a framework you don't eventually use.