36 Replies
The document tells me to put my stuff in MainWindow but I recieve errors doing that.
Take a look at the
App.axaml.cs
:
It should be clear what Window
is used for.
Maybe you start without avalonia targeting everything and concentrate on desktop dev first.
It should be way easier for a beginner.What should I use WPF?
Oh
I see your point
WPF is for Windows only
So I can stick with avalonia? But only focus on desktop?
Yes, depending on your goal - but for test purposes and would suggest using MVVM App targeting desktop dev, without browser/web assembly and mobile
Since you mentioned WPF which is strongly bound to the MVVM pattern.
I should proceed with WPF then switch to Avalonia?
Are familiar with the MVVM pattern?
Not at all.
Are you familiar with MVC or MVP?
No I am not familiar with any type of model patterns
Do you wanna make a GUI program to run on windows?
Yes
Start with WinForms, it's event-driven and definitely easier to work and understand than WPF, Avalonia, Xamarin, Maui, etc.
I got roasted using WinForms cause I asked a question which requires a MVVM approach
Then they told me to learn WPF
I am familiar with the xaml but not MVVM
WinForms can be used with the MVVM pattern, somehow, but it's not designed to do so; WPF was designed to use it.
So, for beginners, I strongly recommend starting with something that doesn't need to be build in a strict pattern.
A WinForms application isn't outdated or anything, WinForms is a good, quick and still up-to-date way to design applications which concentrates on delivering results and not having fancy stylings and animations, etc.
So why WinForms make it easier for me to learn MVVM if it isn't going to force me to use it or designed for it?
It doesn't, it will make it easier for you to eventually have a working application
I am somewhat experienced with WinForms but the app I am trying to make needs to use MVVM I guess
Once you get familiar with OOP and everything related, like encapsulation, you start to learn a design-pattern, like MVVM.
But the basic for any design-pattern is working in OOP rules.
Oh thats good advice
So how can I practice my OOP usage
Why do you think it needs MVVM? - It's just a design-pattern and won't make any difference on the result of that application.
My application has a main window and a bunch of popup windows that has their own pages, own functions which mangles with the main windows properties, since I don't know MVVM it's not my thought I asked here and they told me to go this path.
Just my 2 cents here, make it work first, refactor later.
A design-pattern is something you learn later on; first you need to get the hang of OOP.
Of what you describe, WinForms is totally capable of doing so.
I would strongly advise against using Winforms if you're not forced to use it, Avalonia is much better
Yeah I understand your point but how do I get the hang of OOP, the apps I coded to practice my c# knowledge didn't require OOP
is Avalonia harder than WPF?
Not at all
But just like Spreed said I don't know OOP well and Avalonia has a MVVM structure
It is, it is for someone without any knowledge of object-oriented programming ...
In that case I would avoid GUI applications and just build console apps, GUI adds another layer of complexity that makes it harder to learn core concepts.
Well, you'd usually use MVVM with WPF as well 😅
At which point should I decide to go GUI
When you have a general understanding of core C# concepts, like inheritance, interfaces, Generics, LINQ
You don't have to be an expert at all, but having an understanding of core concepts would make building GUI apps much easier
Well how do I get that understanding cause normally I try to create a project using my knowledge, even though I know a bit of OOP I couldn't think of a project I would use it,(or it gets too complicated for me) what should my approach be in this kind of situations?
Applying what you've learned by building projects is essential and you should keep doing that, but also reading official docs helps a lot of times.
Now for how to approach that, if you have a project in mind, try to make it in a console application for now (because GUI adds a lot of complexity)
For example if you're building a clinic app, usually you'd have a GUI, but in fact you can use a terminal UI as simple as
thanks
That doesn't mean you should keep building console apps, but until you personally feel comfortable about general concepts I would say console apps are better.
And if you hit an obstacle you can always ask here in this server 👍