How do I go about having two view models communicate with one another using MVVM Light. I know how to use the messenger class and register etc.. Here is my Scenario
One thing you can try out is try to implement Dependency Inversion. Define an interface with some actions/contracts. Implement that interface on MainviewModel. Pass that interface as member variable to SettingsViewModel. So whenever settings view model has to notify something to main, it will use that interface. And additionally, other view models can use same strategy.
public interface IMessenger
{
void NotifyAction();
}
public class MainViewModel:InotifyProprtyChanged,IMessenger
{
public void NotifyAction()
{
}
}
public class SettingsViewModel:INotifyPropertyChanged
{
public IMessenger Messenger{get;set;}
public void SomeCommandExecutor()
{
if(Messenger!=null)
{
Messenger.NotifyAction();
}
}
}