How to get resulting view from RequestNavigate?

Topics: Prism v4 - Silverlight 4
Oct 28, 2010 at 4:37 AM
Edited Oct 28, 2010 at 6:41 AM

I have a pretty basic looking "explorer style" application that I'm building in Silverlight 4 with Prism (v4 Drop 10) and MEF. The navigation style that I'm trying to support is kind of like the experience in "Sql Server Management Studio".


So, I have 4 major regions: "Shell.Header", "Shell.Navigator", "Shell.Tabs" and "Shell.Footer". The Shell.Navigator region is on the left and it contains a view with a TreeView. The Shell.Tabs region is the main region where all the navigation shows up. There is one view that gets put into Shell.Tabs which contains it's own region named "Navigator.Details". Whenever you click a TreeView item, my NavigatorViewModel requests navigation to show something in the "Navigator.Details" region.

That all works fine. However, views that show up in the "Navigator.Details" region may contain datagrid lists of entities that may be edited (MyItemsListView). When a user edits an item from the list, I want to open a new Item Editor view in a new tab and activate the tab. When they save the item that is being edited, I want the original datagrid back in the "detail view" to be reloaded automatically. Previously (before navigation) I was able to get a reference to Item Editor views that I opened because I was using my own method of locating views instead of navigation.

How can I get a reference to the resulting view from a call to RequestNavigate?

I basically need to track the activity of all Item Editor view/viewmodels that are instantiated by MyItemsListView in order to refresh the MyItemsListView editable items automatically.

Here's kinda what I wanted to do (this is pseudo-pseudo-code):


var navigatedToView = TabsRegionReference.RequestNavigate(...);

navigatedToView.GetViewModel<IEditorVM>().EditCompleted += (s,e) => ReloadEditedItem(e.ItemKey);


The Prism navigation API doesn't seem to support this at all right now. I can't even get the resulting view via the navigation callback. Any suggestions on a different way of achieving this? Should I just NOT use RequestNavigate from MyItemsListView when opening an Item Editor tab? 

Oct 28, 2010 at 4:41 AM

I guess one answer would be to use the EventAggregator to get my EditCompleted event...correct?

Oct 28, 2010 at 7:48 PM
Edited Oct 28, 2010 at 7:49 PM


I think that you could use EventAggregator to notify your views if they are in different modules. If the views are in the same module you can also use .Net events.

Additionally, you can find interesting the concept of Journal implemented in Prism. For more information about this you could take a look at the following documentation section in Prism4.chm: View-Switching Navigation Quickstart.

You could obtain an instance of you Journal using the following code (pseudo-code):

this.RegionManager.RequestNavigate("DetailsRegion", "/ItemsEditorView", (NavigationResult result) => 

On the other hand, if you want to check the active views in an specific region, you could use the following code (pseudo-code):


Hope this helps.

Fernando Antivero