I have a setup something like below:
MainWindow ------> MainWindowViewModel
|--Menu
|--Frame
Page1 --------> Page1ViewModel
Page2 --------> Page2ViewModel
Suppose my menu has 2 items in it namely Item1 and Item2. Menu's SelectedMenuItem is bound to a property called SelectedItem in MainWindowViewModel. When I click on Item1 I am navigated to Page1 and similarly when I click on Item2 I am navigated to Page2.
Now, In Page1ViewModel and in Page2ViewModel I want to have the current value of SelectedItem. How can I get that value ?
Before asking this question I have looked at Mediator Pattern as well as EventAggregator but for a newbie(in WPF) like me it is very hard to understand those patterns. Is there any other solutions that I can adopt?
Also I have looked at the accepted answer of this question. I have tried the code given there but I don't get value in Page1ViewModel or Page2ViewModel.
Update ---> @Poke
Sorry, I didn't mentioned that in question.
I have another item in my menu called Item3. When I Click on it Page1 should be visible.
So, now my setup is:
MenuItem | Page | ViewModel
-----------+---------------+-------------
Item1 | Page1 | Page1ViewModel
Item2 | Page2 | Page2ViewModel
Item3 | Page1 | Page1ViewModel
The only difference between Item1 Click and Item3 Click is that :
When Clicking on Item1 :
A Combobox called cbEffects should be visible.
When Clicking on Item1 :
A Combobox called cbEffects should be hidden.