WPF MVVM: How do ViewModels communicate with each other?
Posted
by
Dev1
on Stack Overflow
See other posts from Stack Overflow
or by Dev1
Published on 2011-02-03T22:56:16Z
Indexed on
2011/02/03
23:25 UTC
Read the original article
Hit count: 202
I have a View which has 2 sub views on it and a ViewModel is assigned to each view:
ViewA - ViewModelA
{
ViewB - ViewModelB
ViewC - ViewModelC
}
ViewB has a text box and ViewC has a combobox, both of which i need access from ViewModelA. Not the GUI control itself, but the bound value i.e. .Text of the textbox and .SelectedItem of the ComboBox. Currently i just have ViewModelB and ViewModelC as properties on ViewModelA but it feels wrong.
What's the standard way for view models to communicate with each other without breaking the MVVM pattern? I'm completely new to WPF/MVVM.
© Stack Overflow or respective owner