Determining the Uri for NavigationJournal.GoBack()

Topics: Prism v4 - Silverlight 4
Aug 22, 2011 at 5:17 AM

Hi

This is a bit related to http://compositewpf.codeplex.com/discussions/236762 but unlike the example in that discussion, I think I do have a more valid reason to know where the NavigationJournal.GoBack() is going to and was wondering what approach I should take.  I have two different views that can search for a record (one is a to-do view, the other is a filtered search view) and the user can also create a new record view the menu bar.  When the user closes a record, I use GoBack() to take them back to whatever they used to find or create the record.  The only problem is that if they open an existing record and then create a new record (via the menu), when they close the new record, the GoBack() takes them to the previous record, rather than the to-do or filtered search view.  Basically, I don't want the record editing view to ever be put into the journal (the user should never go back to that view from any where else).

What's the best way to do that?

Thanks

Craig

Developer
Aug 23, 2011 at 9:50 PM

Hi Craig,

Currently, the default navigation journal used by Prism doesn’t provide a way to define the URI used when navigating back or forward. However, Prism allows you to define you own navigation journal to implement whatever functionality you might need.

For example, you could make a navigation journal that implements an overload of the GoBack method where you can give an URI as a parameter and if said URI exists in the journal is backStack, navigate to it. However, once you implement your own navigation journal, the decision of what functionalities you should add depend only of your preferences.

For more information about how to implement a navigation journal you can check the RegionNavigationJournal class in the project Prism of the prism library.

I hope you find this useful,

Damian Cherubini
http://blogs.southworks.net/dcherubini

Sep 12, 2011 at 12:07 PM

Hi Damian

Thanks for the reply.  Your suggestion works really well.

Cheers

Craig

Apr 7, 2014 at 2:01 AM
Damian,

Thank you as well. I was really starting to doubt how well my investment in Prism was when I wasn't able to access the Back Stack. This is a pretty basic operation and I was just dumbfounded that it wasn't part of the architecture. I'm a little less negative because this suggestion worked out pretty well. I was able to replace the Journal with a custom one that provided the needed access to the stacks.

Still, I don't understand the design decision. Yes, you guys did good making it extensible, but every other navigation system allows you to at least modify the previous back journal entry. Why was this left out of the default Prism library?