NavigateRequest not replacing views

Topics: Prism v4 - WPF 4
Nov 22, 2010 at 2:55 PM

I'm really new in prism so maybe it's just stupid's question. (and sorry about my english, it's not my natural).

I'm tring to build wpf application who use view-switching navigation framework and i got this problem: when ever i use NavigateRequest it's works only if the region is empty, else it just don't doing anything. Am i forgetting to add somthing?


Nov 23, 2010 at 9:03 AM

Not sure about WPF, but in silverlight you need to implement INavigationAware and IRegionMemberLifetime in your view/viewmodel. The KeepAlive and IsNavigationTarget need to return true for you to be able to navigate between views.

IRegionMemberLifetime helps you decide whether you want to remove the deactivated view from the region or just mark it as decativated. IsNavigationTarget in INavigationAware helps you specify that the view can be naviagted to using the RequestNavigate.

Try the above and let me know.

Nov 23, 2010 at 9:17 AM
Edited Nov 23, 2010 at 9:18 AM

Thank you for the answer. I'm all ready implemanting IConfirmNavigationRequest (and it got the same methods as INavigationReqwest). I've tried to Implement IRegionMemberLifetime. but still when ever region is filled it's view can't be replaced.

Nov 23, 2010 at 9:53 AM

Can you post the code for the requestnavigate?

Nov 23, 2010 at 10:01 AM
        private void RequestNavigate(string RegionName, string ViewName)
                    new Uri(ViewName, UriKind.Relative));

this is the code i'm using. I got baseView class and this is it prototype:

public class BaseView : UserControl, IConfirmNavigationRequest, IActiveAware, INavigateAsync, IRegionMemberLifetime