I got a MasterPage UserControl which contain 3 user controls (and 3 viewmodels)
MasterView:
-> MenuView (-> MenuViewModel )
-> InfoView (-> InfoViewModel )
-> SliderView (-> SliderViewModel )
In slider view i got a listbox with SelectedItem Property binded to a SelectedItem Property in the view model (SliderViewModel)
when the SelectedItem changes , i want to bubble it all the way to InfoViewModel and to update InfoView.
I can do it with events like i did many times in winforms but i’m looking for best practice way of the mvvm pattern.
another small question is , should i create a viewmodel for the MasterView page as well ? although it does not contain anything beside combining 3 users controls together.
your help will be greatly appreciated
I am not sure about the best MVVM best practise in this scenario but I can think of one way of doing it through MVVM.
You can create a
MasterViewModeland expose a property in masterViewModel for communication between other view models. Like below