This project is read-only.

Set manually the order of the ViewModels creation

Oct 25, 2010 at 7:31 PM
Edited Oct 25, 2010 at 9:53 PM

Hello Marlon,

I am using a messenger.Send/Register between 2 ViewModels. 

The MAINViewModel executing the .Send method is created first. The ViewModel2 which register to a certain type of data is

created after. That means MAINViewModel nevers sends data the first time/app starts to ViewModel2

How can I workaround this?


if my ViewModels would implement an Interface, I could inject those ViewModels to load at startup of the MainViewModel like this

public MainViewModel(IViewModel2 viewModel2)




but I do not want to hang an interface around every ViewModel, above all the interface would be empty LOL ;P

Oct 26, 2010 at 11:07 PM

I am unsure if this is possible with Messenger since I have my own version i,e the IMediator. One thing you can do is to have ViewModel2 send a message which is handled by the MainViewModel and at that stage the MainViewModel knows that it needs to send the data