Navigation with View Injection

Topics: Prism v4 - WPF 4
Nov 9, 2012 at 10:28 PM

I have a view which contains a tab control into which I inject a number of other views. One of the views that is in a tab has a browse button that navigates to a view where the user can select a record. On selecting a record, I call Journal.GoBack. This returns me to my previous view but the OnNaviagatedTo method is not called. Is there a way to update the navigation context to allow a proper return to my previous view?

Andy


Developer
Nov 12, 2012 at 2:24 PM

Hi Andy,

I'm not sure if I have understood your scenario completely. But in my experience, when calling the NavigationService.Journal.GoBack() method, if the navigated view implements the INavigationAware interface then the OnNavigatedTo method is called, allowing to set the logic to initialize the view, the only thing to consider is that the previous view will be called with the same parameters passed when navigating it the previous time.

On the other hand, take into account that the navigation journal can only be used for region-based navigation operations that are coordinated by the region navigation service. If you use view discovery or view injection to implement navigation within a region, the navigation journal will not be updated during navigation and cannot be used to navigate forward or backward within that region, perhaps this could be related to your problem.

If this does not help, it would be helpful if you could provide us with more detailed information about your scenario so we can help you further with this.

Regards,

Agustin Adami
http://blogs.southworks.net/aadami

Nov 12, 2012 at 4:36 PM

Agustin,

The issue is definitely that the journal is not up to date as it has no knowledge of the originator view as it was injected into the tab control rather than being navigated to. I was looking for a method to somehow preload the journal with details of the source view to allow a proper return to it. 

In the end I decided that it was neater to pop-up a window rather than navigate to a different view.

Thanks.

Andy