[Advice] GUI library for C# .NET

Hey guys! I'm a long-time fan of the network, though it's my first time posting here, so I hope it's the right way to ask this sort of things.

I'm looking for a GUI library for C# .NET for a simple GUI application for a company I work for.

I have no expirience with any of the known approaches (WPF, WinForms). I was checking examples of WPF applications and it seems so complex and opionated so I hope it's not the way to go about it.

I found C# bindings for DearImGui (https://github.com/mellinoe/ImGui.NET), which, in priciple, seems to me a simple and approachable solution.

As I have no expirience at all with ImGui in general as well as with DearImGui, I have some questions:

  1. Is DearImGui sufficient for end-user facing GUI, UX wise? The default skin/theme seem like more of a dev-tool GUI style. How easy it is to style and customize?
  2. Does anyone have expirience with the specific .NET bindings package? Can I rely on it for a production app?
  3. Do you guys have any other recommended library that is simple and with easy styling capabilities?

Thanks!


Edited by Itzik Shneorson on

The point of using C# is to be independent of native hardware, so the most portable solution with the least maintenance cost, would be to use the 2D draw call that comes with .NET for writing your own component system. https://docs.microsoft.com/en-us/dotnet/api/system.drawing.graphics.drawimage

GUI frameworks are like sandals, easy to get started with (because of pre-made components) but eventually you grow out of them (because you need to implement your own custom components) and they just end up slowing you down (because now your custom components break style with standard components and you have to write all components to customize the behavior).

  • The GUI frameworks that come with .NET and Java are fine for in-house and database applications, with tab stops, internationalization, getting font size from system preferences and such. These are tightly coupled with the operating system to handle all the special cases and settings that most developers never even heard of. But you would never use a GUI framework targeting office applications for a high-end artistic application where every pixel needs to be controlled for a perfectly branded and innovative user experience.

  • Then you have the simpler kinds of GUI frameworks for C/C++ (my own GUI framework included) that come bundled with game engines and such, where you can apply your own skins and custom themes. These usually have the same consistent style across different platforms and are okay for low budget artistic applications and games, but using these for commercial applications where customers have a variety of disabilities and nationalities would be a nightmare, when frustrated customers can't use your service and you have to start over during crunch-time.

  • If your company has the time and money to make a really good looking interface for millions of end users, you can minimize the risks by not using any of the pre-made GUI frameworks. If you were going to redesign all components from scratch anyway for a branding that simple skins and settings can't give, all that's left of pre-made GUI frameworks is the abstract component class letting you override drawing and user input. Spend a day writing your own abstract component on top of a flicker-free 2D rendering library with alpha filtering. Create an abstract class on top of basic 2D drawing, that defines virtual functions for drawing itself and taking input from mouse and keyboard. You draw its child components clipped from bottom to top, evaluate mouse down events top to bottom, and only count mouse up events as clicks if they are still within the component's bound. Then you allocate one panel component inheriting from your abstract component and give it all the render requests and input from the window. This is a very small amount of code that lets you define your own components from scratch and extend the framework as needed. After around three months of full time work, you will have all the components you need to get started and you will get the time back in the long run by being able to easily add more functionality.


Edited by Dawoodoz on

Thanks a lot for your detailed answer, It really helped me understand the options more!

Although I would really love to, from-scrach GUI implementation it's out of scope for the application in question. It's simply not that important. So with accessbility etc. - it's not going to be widely used application. It's basically just a demo app (It will not become real application at any point), so visuals and functionallity are important, but that's about it. 3 months of work for GUI implementation it's just not possible.

So, according to your reply, the sensible approach is the more conventional GUI libraries for .NET.

Do you have something specific in mind?


Replying to Dawoodoz (#26628)

Tbh when it comes to .NET standard is WPF and Winforms. New tech is emerging like Blazor and Avalonia. I have experience with WPF and Winforms. Tbh most companies would use/buy off the shelf third party libraries (paid/freemium). I've also collabed with Oswald to make an Imgui Wrapper for WPF (https://github.com/HMNBadBoyz/ImWPF) and Winforms (https://github.com/HMNBadBoyz/ImForms) . There's also the question whether you want it to be cross platform or user friendly/accessibly.


Edited by Shazan Shums on
Replying to itziksn (#26629)

In that case, just use the standard GUI designer in Visual Studio and create your own ActiveX components when needed. Maybe just have a picture switching between up and down images for buttons if you need it to look a bit more fancy.


Replying to itziksn (#26629)

WPF and WinForms are OK, but they are older UI frameworks. Don't expect any significant updates to it, or ability to do what newer Windows UI apps can do.

Latest on Windows for C# to create UI's is WinUI that can be used both from C# and C++ - so you have a path to upgrade code to C++ in case C# usage doesn't pan out.

https://microsoft.github.io/microsoft-ui-xaml/

https://docs.microsoft.com/en-us/windows/apps/winui/


Edited by Mārtiņš Možeiko on

Thank you all guys!