✅ Should I use WinForms or WPF for my Windows x32 projects?
I'm an absolute beginner with .Net, VS and C#, but I've a long experience with Delphi and Windows development. So now I'm very excited with this new adventure in C#, but I'm kinda confused about what technology should I use for my Windows project... WPF or WinForms? I feel that WinForms could be the best choice. I only develop Windows native software.
Thank you in advance for your help.
22 Replies
WPF would definitively be my take here then
WPF has been around for over 13+ years, it literally have documentation, tutorial and hacks to cover any issues u may encounter
on top of that u have some cool $wpfuilibs to make your app looks nice out of the box without having to go around making your own controls
MahApps
https://github.com/MahApps/MahApps.Metro
ModernWPF
https://github.com/Kinnara/ModernWpf
Adonis UI
https://github.com/benruehl/adonis-ui
Material Design
https://github.com/MaterialDesignInXAML/MaterialDesignInXamlToolkit
Biaui
https://github.com/YoshihiroIto/Biaui
HandyControl
https://github.com/HandyOrg/HandyControl
WPFUI (Windows 11 inspired)
https://github.com/lepoco/wpfui
Waves (WPF/Avalonia/More)
https://github.com/waves-framework/waves.ui.wpf
now if u want to stretch it to linux, you have Avalonia that is similar to WPF
WOW, ok thank you. From Microsoft tutorials here I thought this was the most similar to Delphi:
https://learn.microsoft.com/it-it/visualstudio/get-started/csharp/tutorial-windows-forms-picture-viewer-code?view=vs-2022&tabs=csharp
(it's in Italian page, sorry)
Esercitazione: Aggiungere controlli dell'interfaccia utente a un'ap...
Aggiungere controlli dell'interfaccia utente per una casella di immagini, una casella di controllo e elementi del pulsante a un'applicazione WinForms visualizzatore immagini con Visual Studio.
What they explained seemed to me exactly what I was looking for.
But form what you wrote I think I was wrong...
winforms is easy to moc and get things done but whenever u want more complex things its a nightmare
While in WPF for example:
Then on the code behind u would have
the above would be WPF
you write your UI in xaml which is similar to xml
so the only real difference is that with WPF u would be writing your controls in xml whereas in winforms u would be drag and dropping it from the toolbox
for basic things that is
Ok, now I'm starting to get it. And yes, WinForms with all the drag&drop to create GUIs is the Delphi way, that's why I was interested in that!
also winforms use GDI while WPF uses DirectX
looks like it wasn't even a question I guess more of I want to winforms, period 😛
well if u decide to try WPF I strongly recommend you do
No no, it is a QUESTION!
Because I'm starting now with C# and I want to do it the right way.
With WPF you can do MVVM which helps a lot presenting your data to your view etc
so there is a lot of things to facilitate it
the benefit of learning XAML is also big sine its what new microsoft technologies use
as well as Avalonia
So even though I develop native Windows applications, system utilities, etc. do you suggest me to use WPF?
yeah
WPF is windows only
UWP and WinUI3 are also windows only (these are also window only, except UWP works on xbox as well)
MAUI is the crossplatform ui for microsoft unhappily it doesn't support linux
all they have in common is that they use a flavor of XAML
and Avalonia is a open source UI Framework that works on mobile, linux and web that looks very similar to WPF and have their flavor of XAML called AXAML
and its overall very close to WPF in terms of dev
And what about WinUI3? Should I use this? Does it use XAML too?
Winui3 is very new so I would not advise u to use it now
yes it uses slightly different flavor of XAML its just minor changes
so learning WPF u will pretty much know how to use the other flavors as they dont differ that much
Oh, ok. So I think I will start learning WPF.
it might be a bit overwhelming at first but do give it some hours of try and anything #gui
Thank you mate! Your advice is precious.
you're welcome $close
Use the /close command to mark a forum thread as answered
And what about APIs? Can I use them in WPF?
as in what? calling some web api?
or are u talking about win32 api
well you can use both regardless of it being wpf or console app
if you're talking about web API u would be using HttpClient or a library if u prefer that would do the calls to the api and give u the result so u can use
if you're talking about win32 api then u need some extra steps
to define the signtura so you can then call it
for example
if I want to bring a app to front using the windows api SetForegroundWindow
Yes, the Win32 API.
Ok, it's like Delphi with slightly different sintax.