Refactor Your App to The MVVM Community Toolkit (feat. WPF!)

  Рет қаралды 11,854

SingletonSean

SingletonSean

Күн бұрын

Пікірлер: 32
@Merlock1010
@Merlock1010 9 ай бұрын
As someone who has been developing a desktop WPF app manually creating all the code, this is exactly what I needed and wanted to do for a while now
@SingletonSean
@SingletonSean 9 ай бұрын
Yep, I used to do it all manually too! Such a time saver.
@jirinovotny9704
@jirinovotny9704 6 ай бұрын
Sean, thank you for demonstrating how to plug in the CommunityToolkit.Mvvm into a XAML-based project. I am getting myself familiar with WinUI 3 where such a practical show-round is very appreciated. I have used the Prism Library in previous WPF projects but it is not under active development much and the community toolkit seems a bit more actively updated and flexible.
@hynkingl8091
@hynkingl8091 28 күн бұрын
Love this video! Could you please add this video to your another playlist "WPF MVVM TUTORIAL" as well, it will definitely help people to utilize that library and boost their learning.
@mariocamspam72
@mariocamspam72 9 ай бұрын
Hell yeah, finally an episode on this one
@vinodedison
@vinodedison 7 ай бұрын
The video and the source code are excellent. Best way to learn mvvm toolkit.
@aemarco
@aemarco 9 ай бұрын
On the viewmodel where you use messenger and error stuff, you should be able to do the inhertiance exactly the other way around and use the Observable Validator as Attribute instead ?! That would save you the additional interface for Navigation (btw. you can use all those base classes as attribute... and inherit from something else. It´s going to generate the base class code in the partial then) The Recipient does have the Messenger as Parameter to the ObservableReciepient base constructor (uses weak one if you don´t pass any). Reason beeing that the Base class can´t know which Messenger you wanna use (weak vs. strong). --> That would probably explain why you had troubles with register and unregister ?!
@mazingguitar
@mazingguitar 9 ай бұрын
Hey Sean - I watch your channel regularly. Do you work with desktop day-to-day? Do you feel like switching to web dev? :P Cheers.
@SingletonSean
@SingletonSean 9 ай бұрын
Since 2021, I do web dev (mostly frontend w/ React) in my day-to-day work. I've always loved the web so it was only a matter of time. I still follow desktop dev since I spent so much time on it in the past. Plus, most of the frontend web concepts apply to desktop dev anyways!
@CuongNguyen-gu9fl
@CuongNguyen-gu9fl 2 ай бұрын
Will there be any tut about building a WPF app with MVVM Toolkit from scratch?
@prameshpradhan1401
@prameshpradhan1401 5 ай бұрын
Thanks for the video. Appreciated 🙏
@emyrulz
@emyrulz 9 ай бұрын
While this is nice and the code looks nicer, it is another dependency that we do not really need. I think with modern IDE and tooling, boilerplate is nowhere near the hassle that it once used to be. Overriding parts of a setter obscures what is really going on. When you got to the validation part, I think that code quickly becomes unreadable if you have complex interactions.
@edvardsavareiko5989
@edvardsavareiko5989 9 ай бұрын
(Re-posting, as my comment vanished for some reason) Considering an alternative to Caliburn for my WPF app, and taking a deeper look into this toolkit. What you've shown here so far looks great, especially the excess boilerplate auto-generation ! I'd like to know though, how did you get x:Bind to work ? My VisualStudio is throwing an error that x:Bind is not supported in WPF, and simply wouldn't recognize it. I've also set the data context in code-behind, following the official Microsoft guide for MVVM Toolkit - but it didn't really help.
@_SkyDancer
@_SkyDancer 6 ай бұрын
Great video tutorial. Thank You.
@williamliu8985
@williamliu8985 9 ай бұрын
Not sure any MSFT employee is watching this video, the VS IDE does have a problem with the Source Generator in my experience. Sometimes restarting VS may resolve the problem, but sometimes it drives me crazy. SG may be a good idea, but VS team doesn't take it seriously enough. I feel much less problematic with Rider.
@MetalJase
@MetalJase 8 ай бұрын
Thanks for your videos! I have a non-parameterless constructor in my viewmodel. Then I set the DataContext to the viewmodel in the view’s constructor. I get an instance of the viewmodel from DI either by putting the viewmodel in the view’s constructor, or ‘App.Current.Host.Services.GetService()’ . Is this OK? How would you set the DataContext to a viewmodel that has a non-parameterless constructor?
@havendv
@havendv 9 ай бұрын
DependencyPropertyGenerator - Another thing to remove boilerplate if you create custom controls
@precastdetailing
@precastdetailing 2 ай бұрын
What do you mean by "page level view model"?
@SingletonSean
@SingletonSean 2 ай бұрын
Good question! A page view model is essentially the root view model of a specific page. As opposed to a component view model, which would be the view model for a component / part of the page. A page view model could be made up of many component view models.
@basharfocke
@basharfocke 9 ай бұрын
Thanks a lot 👍
@oliver-münzberg
@oliver-münzberg 9 ай бұрын
ReactiveUI is my choice for MVVM with MAUI, WPF, etc.
@SingletonSean
@SingletonSean 9 ай бұрын
Always wanted to try ReactiveUI, but never got around to it!
@zwatotem
@zwatotem 9 ай бұрын
Says C# is a good language for not having multiple inheritance, then proceeds to use quirky workarounds to lack of this feature, saying: "it's okay it sometimes has to be like that". But seriously, to be honest I don't see that much trouble in including multi-inheritance in your language. C++'s resolution of the diamond problem always seemed simple and straightforward to me, so I'm not sure, why people still say it's bad.
@windowsbuilderthegreat3121
@windowsbuilderthegreat3121 9 ай бұрын
Wouldn't MVVM tool kit cause unnecessary overhead due to the use of the source generator and attributes. If so, how much of a performance hit would this library be on an application
@SingletonSean
@SingletonSean 9 ай бұрын
It could slow down builds, but from my understanding I don't think source generators have any serious performance implications at runtime.
@aemarco
@aemarco 9 ай бұрын
Source code generation should only run on code changes in the relevant files, so it should not even affect the build to much. But as said in another comment, on bigger projects VS may be bugging out a bit... expeerianced that quite some times myself. ---> On Runtime it should mostly even should be a performance+ in a lot of cases, since all the notifications and such stuff only happens when needed (no use of any Requery Suggested anymore).
@vinodedison
@vinodedison 7 ай бұрын
what's the purpose of services and stores folders
@SingletonSean
@SingletonSean 7 ай бұрын
Good question! Stores contain, manage, and centralize application state, and allow communication between components of your application (ex: view model communication). So for example, one view model in a todo list application might load all the todo items into a TodoStore. Then, another view model might add a todo item to the TodoStore. Since everything flows through the TodoStore, all the view models in the application can instantly update with the loaded and added todo items. On the other hand, services are stateless. They perform some sort of business logic, fetch data from a data store, etc. So in the todo list example, the TodoStore might use a TodoService to fetch the todo list items from the database. I was asked a similar question on the Discord channel a few weeks ago, so I am planning to create a whole video on this topic!
@ABMedia83
@ABMedia83 Ай бұрын
I never have done MVVM from scratch anyway, it's called a Class Library for a reason. You should never be doing MVVM completely form scratch all the time. You put the basics in a class library and then you add on to that.
C#/WPF - Learn MVVM with the .NET Community Toolkit
1:46:13
Kevin Bost
Рет қаралды 54 М.
What is the MVVM pattern, What benefits does MVVM have?
22:38
James Montemagno
Рет қаралды 99 М.
How do Cats Eat Watermelon? 🍉
00:21
One More
Рет қаралды 12 МЛН
GIANT Gummy Worm Pt.6 #shorts
00:46
Mr DegrEE
Рет қаралды 127 МЛН
How much does the Windows Community MVVM Toolkit REALLY help us?
7:02
Microservices are Technical Debt
31:59
NeetCodeIO
Рет қаралды 461 М.
5 Signs of an Inexperienced Self-Taught Developer (and how to fix)
8:40
.NET and C# are in trouble. Here is what I'd do.
10:57
Ed Andersen
Рет қаралды 78 М.
What is the Smallest Possible .EXE?
17:04
Inkbox
Рет қаралды 406 М.
NSURLProtocol: How I Stole an App For My Wedding
56:25
Bryce Bostwick
Рет қаралды 43 М.
MVVM Source Generators: Never Write MVVM Boilerplate Code Again!
19:25
James Montemagno
Рет қаралды 76 М.
How do Cats Eat Watermelon? 🍉
00:21
One More
Рет қаралды 12 МЛН