Click here to Skip to main content
15,913,486 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
What is the best way to instantiate a view and the corresponding view model in WPF application within the MVVM pattern? In other words, when an application launches maybe there is an main view that is launched and the corresponding view model is somehow created. On the main view, the user is able to click on a button that has the command property bound to an ICommand object in MainViewModel. The purpose of the button is show data on a different view. So what is the best way for the new view and corresponding view model to be instantiate and the view to Show? Without the MainViewModel doing the work. With MVVMLight, it there a standard technique that is commonly use?

Thanks
Posted

1 solution

Hi Samuel,

Please follow this link. This will give you basics understanding on MVVM pattern,

1) MVVM Pattern in WPF: A Simple Tutorial for Absolute Beginners[^]
2)http://www.c-sharpcorner.com/UploadFile/raj1979/simple-mvvm-pattern-in-wpf/[^]
 
Share this answer
 
Comments
samuel_april 7-Feb-14 8:17am    
Thanks. I have already read link 1. It is very good. But I don't think it really addresses my question. I think the article only shows a MessageBox from the main view model. Doesn't even involve another view model. I am talking about another view and view model. Where and how would they get create? Outside of the view model. I suspect the answer going to involve a messaging service. Thanks

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900