Тёмный

C#/Avalonia - Learn MVVM with Avalonia 

Kevin Bost
Подписаться 3,8 тыс.
Просмотров 10 тыс.
50% 1

Avalonia: www.avaloniaui.net/
CommunityToolkit.MVVM: learn.microsoft.com/dotnet/co...
My dotnet templates:
github.com/Keboo/DotnetTemplates
Broadcasted live on Twitch -- Watch live at twitch.keboo.dev
Search video contents here: github.com/Keboo/RU-vidSubti...

Наука

Опубликовано:

 

14 янв 2024

Поделиться:

Ссылка:

Скачать:

Готовим ссылку...

Добавить в:

Мой плейлист
Посмотреть позже
Комментарии : 54   
@androdla
@androdla 3 месяца назад
I'm learning Avalonia and MVVM, and this video is absolute gold. Thank you.
@Kitokeboo
@Kitokeboo 3 месяца назад
Glad to hear it. Happy coding!
@melsawy93
@melsawy93 5 месяцев назад
Nice, was waiting for you to cover this! Cant wait to watch this! Thank you!
@Kitokeboo
@Kitokeboo 5 месяцев назад
Great let me know if you have any feedback or critique on it. Happy coding.
@__rikaisuru
@__rikaisuru 2 месяца назад
I love you. Your pedagogy is great for absolute beginners. Your experience shines through, that's for sure.
@sizzlinggw2
@sizzlinggw2 2 месяца назад
Thanks for this video, it really helped me get started. Love how you show some troubleshooting and debugging in between too, it shows how to approach the things that might go wrong.
@Kitokeboo
@Kitokeboo 2 месяца назад
Thanks for the kind words. Happy coding!
@isaacthor3186
@isaacthor3186 Месяц назад
The most comprehensible yet thorough tutorial I've ever watched. Amazing work mate
@Kitokeboo
@Kitokeboo Месяц назад
Thanks for the kind words. Happy coding!
@joegopher9280
@joegopher9280 5 месяцев назад
Extremely helpful!
@zzing
@zzing 3 месяца назад
Thank you for this, half way done but never really saw a good explanation for what a view model was. Now I can see that it is sort of like a model and controller somewhat combined. The stuff on the plumbing was extremely helpful, it does seem like a clunky version of signals that Angular is now offering. But at least it is easy to use!
@Kitokeboo
@Kitokeboo 3 месяца назад
Yea I can see that. If you want something a bit more basic on the community toolkit, I did a stream on it when it first came out. It uses WPF however most of the content in it is focused on the view model side of things rather than on the XAML. You can check it out here: ru-vid.com/video/%D0%B2%D0%B8%D0%B4%D0%B5%D0%BE-uVIzK2snugk.htmlsi=GpQAIpv0pmKRNyZJ Happy coding!
@avaloniaui
@avaloniaui 3 месяца назад
This is fantastic! ❤
@Kitokeboo
@Kitokeboo 3 месяца назад
Thanks. Looking to do more Avalonia content in the future as well.
@avaloniaui
@avaloniaui 3 месяца назад
@@Kitokeboo Fantastic! Let us know if you need anything from us!
@DenisIoan
@DenisIoan 2 месяца назад
Thank you very much!
@Kitokeboo
@Kitokeboo 2 месяца назад
:) Happy coding
@MrOudoum
@MrOudoum 5 месяцев назад
In AvloniaUI you can also directly bind public methodes in the ViewModel to Commands in the View.
@Kitokeboo
@Kitokeboo 5 месяцев назад
Yea this is one area I think I could do an additional video on. The binding syntax in Avalonia is very rich.
@robgreenhill5990
@robgreenhill5990 4 месяца назад
Very informative :) Thank you If you are looking to do further Avalonia tutorials I would really know how to pass the Current Selected Datagrid row back through InvokeCommandAction CommandParameter !!
@exception6858
@exception6858 5 месяцев назад
Very cool! Started diving into Avalonia as well. Didn't have any development experience in MVVM architecture before. How to properly interact from View with ViewModel in Avalonia? It turns out that events available on UI elements can be useful to use in a ViewModel, but how to make the communication correct from an MVVM perspective, I can't figure out.
@Kitokeboo
@Kitokeboo 5 месяцев назад
Great question. There are varying techniques, but something that often gets overlooked is that it is perfectly fine in MVVM to register for the events using the view's code behind, and then in the event handler simply call methods on your ViewModel. At the most basic, this is what many techniques attempt to optimize or simplify, but there is nothing wrong with doing it manually. The key is to keep the important logic inside of the view model.
@exception6858
@exception6858 5 месяцев назад
@@Kitokeboo thank you! You are awesome!
@IT-Entrepreneur
@IT-Entrepreneur Месяц назад
"World, i'm not that fat" xD. Best comment
@darianasonova5394
@darianasonova5394 5 месяцев назад
Make more tutorials with avolonia!! It's really interesting
@Kitokeboo
@Kitokeboo 5 месяцев назад
Glad to hear it. Been playing with it and enjoying it so there will be more! Happy coding.
@parko1965
@parko1965 3 месяца назад
Nice video. One question how would you use the MVVM toolkit's RelayCommand CanExecute with complex properties? Assuming a User class with two string props UserName and Password?
@Kitokeboo
@Kitokeboo 3 месяца назад
I assume the intent here, is how to handle complex properties being passed as the command parameter? There are two ways to go about handling it. The simplest is to simply bind the relevant values to properties in the view model and have the command's Execute/CanExecute method act on those properties rather than using the CommandParameter. The second option is to leverage a MultiBinding with a value converter and bind both of those properties to the CommandParameter property. The value converter would need to return some object that contained both the UserName and Password, and the Command's Execute/CanExecute would be updated to take in the object (as a parameter) returned from the value converter. The Avalonia docs on MultiBindings are here: docs.avaloniaui.net/docs/guides/data-binding/how-to-bind-multiple-properties Personally, I tend to go with the first option most of the time as it is much simpler to implement.
@DevLife717
@DevLife717 5 месяцев назад
I’ve been doing Flutter for almost a year and in all honesty it’s pretty good. But state management and json serialization aren’t the best dev experience. However in comparison Avalonia and CommunityMvvm looks amazing together and watching you code makes me miss the power and expressiveness of C#. Dart is pretty good and definitely tolerable but it just can’t compare with C#. Will finish the video tomorrow- gotta get to bed😊
@Kitokeboo
@Kitokeboo 5 месяцев назад
Great. Let me know if you have any questions. Happy Coding!
@SirBenJamin_
@SirBenJamin_ 5 месяцев назад
I also love my WPF, but it feels as though it's not getting any love from Microsoft and I don't know where Microsoft desktop app development is really heading ... it seems to be on the back burner and they're focusing on Mobile tech and Web tech. The new Maui stuff looks to be more mobile app based, and not sure about WinUI3. I had a quick play with Avalonia and did some tests with text rendering (which is slow in WPF), and it seems to be a lot more performant that WPF, so that's cool.
@Kitokeboo
@Kitokeboo 5 месяцев назад
Yea they have come out with several frameworks over the years but nothing has stuck as well as WinForms and WPF. There is a big focus in cross platform development and Avalonia is looking really good from my perspective. Will be looking to play with it more in the future
@SirBenJamin_
@SirBenJamin_ 5 месяцев назад
@@Kitokeboo yes, Avalonia is looking really good. I think Microsoft will end up just buying them out :D .... Btw the way, have you tried the built in "snoop" tools for Avalonia? .. again .. pretty cool. One thing I had noticed though is that when you run the Browser project, the performance when resizing the window is pretty bad. I created a simple window containing a 3x3 uniform grid of 9 red borders, and then an indeterminate progress bar on top. When you resize the browser window you see what looks like two versions of the buffer, the old size and the new size at the same time.
@angr7
@angr7 2 месяца назад
Thx for nice video, like you style. Very nice for experienced beginners in Avalonia. For me, this video lacks model implementation(it's probably out of scope). Can you recommend a nice overall video about MVVM in WPF i assume it will be suitable for Avalonia. My team recently uses winform, but we are planning migration to Avalonia. So I'm looking for a "best practices" and "rules of big thump".
@Kitokeboo
@Kitokeboo 2 месяца назад
Great question. I often leave the model out of my samples as it can take a lot of different forms depending on the type of application you are building. For something super simple with a local database you can use Entity Framework Core with SQLite. You can see some videos where I work on a project "Rentopoly" here: Part 1: ru-vid.com/video/%D0%B2%D0%B8%D0%B4%D0%B5%D0%BE-abdiokqqEl8.html Part 2: ru-vid.com/video/%D0%B2%D0%B8%D0%B4%D0%B5%D0%BE-QBeIdK95d9c.html For more enterprise-y software your "model" often becomes API's models using something like HttpClient (learn.microsoft.com/dotnet/fundamentals/networking/http/httpclient-guidelines?WT.mc_id=DT-MVP-5003472) to make the calls to a backend web service.
@CH-pv3te
@CH-pv3te 29 дней назад
Great video, any chance you do a deep dive on DI in avalonia?
@Kitokeboo
@Kitokeboo 28 дней назад
Yea I would be happy to put it on the agenda. I do have one video on the generic host which is directly applicable to Avalonia as well that you might find useful. ru-vid.com/video/%D0%B2%D0%B8%D0%B4%D0%B5%D0%BE-j3pl2tkBM1A.html
@CH-pv3te
@CH-pv3te 28 дней назад
@@Kitokeboo Thanks for this, I've only recently discovered your channel, very impressed!
@user-xg7hi5mh3g
@user-xg7hi5mh3g Месяц назад
Which default font family is using the Avalonia UI
@Kitokeboo
@Kitokeboo Месяц назад
Great question. I had to do a little digging, but you can find a reference to the default font here: github.com/AvaloniaUI/Avalonia/blob/9be975b0e4874bc5d1cad4872615db40959a2430/src/Avalonia.Themes.Fluent/Accents/BaseResources.xaml#L6 That font is embedded and you can find the font files here: github.com/AvaloniaUI/Avalonia/tree/9be975b0e4874bc5d1cad4872615db40959a2430/src/Avalonia.Fonts.Inter/Assets This was also discussed here: github.com/AvaloniaUI/Avalonia/discussions/11413
@pluto7562
@pluto7562 5 месяцев назад
WinUi 3 enjoyer in shambles
@Kitokeboo
@Kitokeboo 5 месяцев назад
Yea I understand that. Happy coding.
@0x0C5A170E
@0x0C5A170E 2 месяца назад
How did he move the xaml code at 23:00
@Kitokeboo
@Kitokeboo 2 месяца назад
That is a trick in VS where you can move lines (or your selected lines) up and down with Alt+Arrow Key. If you look in the top left corner of the screen I run Carnac that will show off keyboard shortcuts when I use them. You can also find more here: learn.microsoft.com/visualstudio/ide/productivity-shortcuts?view=vs-2022&WT.mc_id=DT-MVP-5003472#code-editor Happy coding.
@0x0C5A170E
@0x0C5A170E 2 месяца назад
@@Kitokeboo Thanks! I thought it was some kind of extension, but I just have a non-standard keyboard mapping scheme.
@sergejsteinsiek4723
@sergejsteinsiek4723 2 месяца назад
Do u make ûdemy courses? I would buy them because noyone ever explain wpf better than u.
@Kitokeboo
@Kitokeboo 2 месяца назад
Thank you for the kind words. I have considered it but not right now.
@damascake
@damascake 3 месяца назад
Why ViewModels messaging each other, instead of update The Model?
@Kitokeboo
@Kitokeboo 3 месяца назад
Great question. Both are viable options and it depends on what you're doing in the application. Sometimes there are situations where you want to notify the rest of the application that something has occurred and typically a message like what was shown is one of the easiest options. However there are certainly situations where updating the model makes the most sense so that that information can be persisted
@HotSaab
@HotSaab 14 часов назад
White text on fucia == very bad viewer experience! Far too difficult to comfortably view in this tutorial environment especially after youtube has manipulated the video. 👎
@theman3282
@theman3282 3 месяца назад
this should focus on what community toolkit do and how they do their thing/integration inside avalonia, rather than 10 years old mvvm lingo those who don't know it go watch/read somewhere else please!.
Далее
Microsoft FINALLY killed it
6:45
Просмотров 572 тыс.
Осторожно селеба идет 😂
00:16
Просмотров 308 тыс.
Avalonia UI - 06 - Dependency Injection
7:45
Просмотров 3,1 тыс.
Don't Use Polly in .NET Directly. Use this instead!
14:58
Brutally honest advice for new .NET Web Developers
7:19
When you have 32GB RAM in your PC
0:12
Просмотров 251 тыс.
ОБСЛУЖИЛИ САМЫЙ ГРЯЗНЫЙ ПК
1:00