NavigateFrom and NavigateTo not being called

Topics: Prism v4 - WPF 4
Aug 19, 2013 at 8:40 AM
iv'e got tow viewmodels (implementing IConfirmNavigationRequest ) , which can be propagated into a region using navigation .

1) if i call the first and then the second :

NavigateFrom is called in the First and NavigateTo is called in the second
and my navigation callback is called

2)but if i call second and the first :
Nothing occurs . (no navigation)

In both cases the navigation is called as such :
 _regionManager.RequestNavigate(requests[i].RegionName, new Uri(requests[i].ViewName, UriKind.Relative),OnNavigationComplete); 
any ideas what could be causing this behavior ?

(Again if call the navigation in the order described in (1) everything is o'k
and if the order is (2) navigation never occurs )
Aug 20, 2013 at 5:36 PM
Hi,

Based on the scenario you described us, there wouldn’t be any special considerations for this to run. As far as I know, OnNavigatedFrom and OnNavigatedTo shouldn't be the cause of the problem if the navigation does not occurs. However, I think you should verify the following:

  • Requests[i].RegionName and Requests[i].ViewName exist and are correctly spelled as equals to its registration name.
  • The views are correctly registered in your Container.
  • The Request.Navigate call from the second view is executed.
Also, take into account that the Navigation API swallows any type of exception so any issue regarding the navigation won't be output. Therefore, if you need to know if there is an exception in your navigation, you can subscribe to the IRegionNavigationServiceNavigationFailed event to get more details.

You may also find helpful the following thread:

If that doesn't help you, it would be helpful if you can provide us with additional information on how the Navigate requests and the OnNavigatedTo and OnNavigatedFrom methods are implemented.

Hope this helps,

Federico Martinez
http://blogs.southworks.net/fmartinez