WPF Switching Views With Navigation Using MVVM And Dependency Injection

WPF Switching Views With Navigation Using MVVM And Dependency Injection

Payload

1 год назад

50,336 Просмотров

Ссылки и html тэги не поддерживаются


Комментарии:

@nguyenminhduc98b2
@nguyenminhduc98b2 - 29.11.2023 18:09

nice video, it helps me alot!

Ответить
@LaRay314
@LaRay314 - 23.11.2023 21:17

Is it possible that at minute 16 were you create the RelayCommand it doesn't work at older .net versions? Because I have 4.8 and when I write down in my opinion the same command then visual studios doesnt like it and it occures an error.

Ответить
@Stor_Man
@Stor_Man - 18.11.2023 23:19

Which theme do you use in Rider?

Ответить
@eassgermany4267
@eassgermany4267 - 03.11.2023 20:05

@Payload what is the name of IDE you used?

Ответить
@on4ayl
@on4ayl - 24.10.2023 11:45

Great video. I had to use a magnifying glass to view the code. Font is too small.

Ответить
@stiffled0
@stiffled0 - 03.10.2023 23:30

For some reason "ContentControl" in MainWindow is displaying the name of the viewmodel class file name rather than display the view that it's associated to?

Ответить
@asrielknight
@asrielknight - 29.08.2023 16:43

hey! i know its been like 7 months since you posted this but is there any way you could tell me how id set a default CurrentView? i want the homeview i have to be a navigation hub and i cannot for the life of me figure it out. thanks!

edit: also, how do i pass in a variable to a view im switching to?

Ответить
@mattaku9430
@mattaku9430 - 09.08.2023 23:17

Oh man, a service locator, can we do it without the service locator?

Ответить
@TheLecoste
@TheLecoste - 07.08.2023 22:05

Excellent content as always. Note on the observableobject and relaycommand core files. communityToolkit.mvvm might now be an alternative here maybe?

Ответить
@gamegame4713
@gamegame4713 - 04.08.2023 10:50

Thank you for this video, very helpfull, i was wondering how to pass parameters with navigation, i changed the factory from Func<Type,ViewModel> to Func<Type, object,ViewModel> so i can pass parameter as an object, but i don't know if this is the right way, even if it works

Ответить
@user-bf2sg5lm1u
@user-bf2sg5lm1u - 21.07.2023 11:24

Thank you very much for this great video. I studied a lot by myself, finally I can do it.
BTW, may I ask that, is it possible to do a multi-navigation.
For example, 2 views in 1 window, and there are 2 subviews in one view of window.
It can be contentcontorol or tabcontrol.
Thanks.

Ответить
@user-pf3jz7we2d
@user-pf3jz7we2d - 11.07.2023 18:09

Hello Payload! I have a question. Maybe it`s kinda stupid question. So, should i use MVVM when i have a lot of different windows with different functionality (I am making diary, and there I have MENU window and other window where I working with all that writing stuff)?
So, I have 3 groups
(1.Main menu window and window with all writing and editing stuff,
2. account settings and customizing window to change look of main menu window (i have button on main menu window to navigate to them)
3. Login and registration).
I guess they would look good with MVVM, but i am not sure if they can be putted together like that. Should i put all those windows that i work with, right into folder MVVM, and working there with those groups? Thank you in advance

Ответить
@benkenobii2057
@benkenobii2057 - 09.06.2023 18:14

How to set child view model properties from parent? When i do that, the child User Control displayed on the main window parent does not change its properties, i have set the data context

Ответить
@abner_pm
@abner_pm - 07.06.2023 16:58

great job🤪

Ответить
@johanmilterjakobsen1627
@johanmilterjakobsen1627 - 01.06.2023 01:21

Really nice video, i have learned a lot from you and this video! One thing though im a bit confused of is how do to set the other ViewModels DataContext? Its just i have tried something, that doesnt work the way i expected... You can try it youself by deleting the MainViewModels ButtonBindings, and then try to press the buttons on either HomeView or SettingsView. When i try it, it doesnt work?

Ответить
@user-kl3yy9uo8v
@user-kl3yy9uo8v - 24.05.2023 18:39

are UserControls created every time we click a button to go to them, or they have only one instance?

Ответить
@robstark4062
@robstark4062 - 08.05.2023 07:49

Thank you for this tutorial, I must say it is the simplest I ever watch. For the next can you make a tutorial about passing data using this navigation. Thank you!

Ответить
@vincentvega4934
@vincentvega4934 - 30.04.2023 18:49

I ran into the problem that this approach does not work in the case of nested windows. Can it work, or should I look for another approach?

Ответить
@andreim2981
@andreim2981 - 30.04.2023 01:50

What if you open windows? Do i register the view models as transient? It is complicated when you have to use child forms

Ответить
@surajrohira6384
@surajrohira6384 - 13.04.2023 18:36

Beautiful, you cant imagine how long I have been looking for this, it is exactly what I needed. Thanks!

Ответить
@Malcrom1967
@Malcrom1967 - 09.04.2023 16:38

Well I got through this toward the end but new RelayCommand(execute: o:object => gives errors.

Ответить
@nagyabel937
@nagyabel937 - 05.04.2023 21:27

is it working under .NET 6?

Ответить
@DonaldFranciszekTusk
@DonaldFranciszekTusk - 05.04.2023 01:46

It's so complicated :/ I don't understand why this is such a different approach from what you used to switch views before. In your previous video ('Modern UI app') you made it much simpler, just reassigning CurrentView with Command on click, and switching between views worked the same.
Couldn't it be done as easily as in that video? I appreciate that you show how something is done, but if this is supposed to be a tutorial, it would be better if you did a longer introduction before doing it, what and why exactly you want to do.

Ответить
@fainergame3842
@fainergame3842 - 31.03.2023 17:36

Hello, can someone tell me how to make authorization with this code? Those. so that I can log into my account and I can get the UserControl output working.

Ответить
@user-rl3lp5rv8q
@user-rl3lp5rv8q - 22.03.2023 17:01

I have similar code but I dont need creating new instance of viewmodel every time I change views. I have a lot of data that viewmodels are storing and this method of changing views would terribly slow down the program

Ответить
@user-rl3lp5rv8q
@user-rl3lp5rv8q - 22.03.2023 16:57

Does this code create new instance of someViewModel every time you change views? how to create and use only 1 instance for every viewmodel?

Ответить
@Andrei-qi4tm
@Andrei-qi4tm - 19.03.2023 19:08

Very useful what you did here!

Ответить
@j4ck3
@j4ck3 - 06.03.2023 01:30

Hello, nice tutorial. just wondering if there is a simple way to pass parameters to other viewmodels when navigating to one?

Ответить
@megachill
@megachill - 03.02.2023 02:53

Awesome, would love to see a version using community toolkit and what that would change.

Ответить
@Harmeet50
@Harmeet50 - 31.01.2023 17:22

Absolutely amazing. Right what I was looking for. After searching for this on You tube and Linked, landed on this video after many months. Thanks for your help.

Ответить
@amied658
@amied658 - 30.01.2023 05:53

This was amazing. Thank you so much. 👍

Ответить
@yobofunk5689
@yobofunk5689 - 28.01.2023 22:53

Thank you. Wouldn't it be a bit more modulable if instead of derivating the Core, having a IServiceNavigation interface ? Then simply init the class with the navigation, then its command... Nit picking I guess, but it woudl feel more reusable.

Ответить
@charlesgantz5865
@charlesgantz5865 - 17.01.2023 09:11

What does (???). in the various Path's mean?

Ответить
@botlife6386
@botlife6386 - 16.01.2023 10:09

can u do a updated version of the chat hub with a login and setup the database but make it where it saves the last chats and how to add calling and video chat and make it a add function plz

Ответить
@ricardocasillas5054
@ricardocasillas5054 - 16.01.2023 05:23

Great tutorial. Totally cool, simple but effective. where can we get the source code, save me some key strokes. Thanks,

Ответить
@NiklasKage
@NiklasKage - 16.01.2023 00:50

Thank you for this great tutorial! As a newbie this was really informative.

Ответить
@zakiisse7519
@zakiisse7519 - 15.01.2023 17:27

Fantastic tutorial!! 😊

Ответить
@onyekaidika355
@onyekaidika355 - 15.01.2023 16:50

Amazing as always ❤️

Ответить
@natlinux
@natlinux - 15.01.2023 15:56

I was so happy to finally see a video again. greate job

Ответить
@player_yousef
@player_yousef - 15.01.2023 14:55

nice

Ответить
@chriswinslow
@chriswinslow - 15.01.2023 14:39

Great tutorial. But the volume is a little on the low side.

Ответить
@someone150
@someone150 - 15.01.2023 14:30

What keyboard do you use?

Ответить
@haku5957
@haku5957 - 15.01.2023 14:08

ty bro

Ответить
@faxtixe8445
@faxtixe8445 - 15.01.2023 13:07

whys bro awake at this time

Ответить