This project is read-only.

comunication of different NavigationContents(or ViewModels)?

Jul 12, 2010 at 3:29 AM

in my code:



                <i:EventTrigger EventName="MouseLeftButtonUp">
                    <nRoute:NavigateAction HandlerName="ContentContainer" Url="Views/MoniSectionSubject/ChoseTaskView/">     

<!-- Here i want to show the return value of  "Views/MoniSectionSubject/ChoseTaskView/" --> 


                <nRoute:BrowsingContainer x:Name="BrowsingContainer">
                        <nRoute:NavigationHandlerBehavior HandlerName="ContentContainer"/>


in my ChoseTaskViewModel:

public class ChoseTaskViewModel : NavigationViewModelBase
        public ObservableCollection<WQ_MoniScheme> Schemes { get; private set; }
        public ObservableCollection<WQ_MoniTask> Tasks { get; private set; }
        public WQ_MoniScheme CurrentScheme { get; set; }
        public WQ_MoniTask CurrentTask { get; set; }


 Schemes and  Tasks  bind to two ListBoxs,  CurrentScheme and CurrentTask bind to the selecteditem of the two ListBoxs, also are my return values of the ChoseTaskViewModel,

which should be show in the TextBlock of KaoheSectionView.xaml.

how to do this? use the Action?  thanks!!! 

i think it's the problem of comunication of different NavigationContents.


Jul 12, 2010 at 9:49 AM

Well, there are many ways to do inter ViewModel communications, but probably the best any easiest way to do so is to use Observable Channels - they allow you to communicate without the communicating parties having to keep direct references. Read about it here: and

Also depending on you your logical encapsulation of functionality, you could use something called ViewServices to accept input from another View/ViewModel. Have a look at how in this Sudoku game we use IBoxValueViewService to solicit user-input

Hope this helps,