I've got a question of the MVVM-Pattern. So I'm not sure, that I've had understand it completely.
My scenario:
- ViewModelLocator : Provide the requested ViewModel to a specified view.
- LoginViewModel: ViewModel for the LoginView
- MainPageViewModel: ViewModel for the MainPageView
My example app. is simple: The user can login and comes to the MainPageView.
The MainPageView uses the MainPageViewModel. I use the messenger of the MVVMLight framework to navigate from the LoginView to the MainPageView.
Messenger.Default.Register<LoginPerson>(this, Constants.NavigateLogin,
person => this.Window.SetContentControl(new MainPage(person)));
I pass the loggedin person to the View. The MainPage - View will set the the logged in person to its ViewModel (=> MainPageViewModel).
Is this way correct? I don't think so :-) How can I communicate between the ViewModels? Thanks for your advices.
Regards, pro