简体   繁体   中英

PRISM Region loses Context during navigation

I created an application using PRISM and it's navigation features. There is main region in this app which Context contains current logged user. In this region I dynamically load views using RegionManager.RequestNavigate . Views contains other views with separate view models. It's all fine except that main views exist all the application time and when I go out from view and return back view is the same as it was, ie it's not to be created again. What I've done: in the main view models I've implemented INavigationAware with IsNavigationTarget setted to false. Views are created every time, but there is exception about "could create nested region cause of it's already registered". Then in main view model I implemeted IRegionMemberLifetime with setted KeepAlive to false. It's all fine but when navigate from view and navigate to it again main regions's Context loses it's content.

How can I Fix it?

Thanks

UPDATE:

I prepared working sample PrismNavigationSample.zip for fully understanding my question.

Try this in both projects: Go to a first view, change slider value, return back and go to the first view again. Also see on Context value on the window above.

I've found the answer on the Codeplex . See RegionContext lost when removing a view from a region for more details.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM