Navigate to same Page?

Aug 6, 2011 at 1:03 PM

Hello,

is it possible to navigate to the "same" Page with caliburn on wp7?

Since this is not supported yet on WP7, it would be good if Caliburn could somehow create a new instance of the current view and navigate to there.

 

Regards, Marc

 

Coordinator
Aug 7, 2011 at 11:43 PM

Just curious, can you describe the use case for that?

Aug 8, 2011 at 6:15 AM

Hi,

I have categories with children and I need something to browse them.

At the moment I'm using a listbox and do everything with one Page: When the selection changes, I get the new data (category) and bind the children to the view.

I thought it would be ok, just to pass the next category id to the new page. This way I wouldn't need to catch the back button and get the previous data for simulating the back navigation, and I could get use of page transitions. But I'm not sure if that would work - maybe no :-)

How would you implement a use case like this?

Thanks

Marc

Aug 9, 2011 at 9:33 PM

I would, in this instance have a child view that handles this. You would navigate to the page once but you would use the child view (A UserControl would be a good fit here) to handle any nested navigation. The problem I see with your proposed method is that each one of those page nav's are going to populate on the navigation stack and it is no fun having to press back fifteen times to get back to the last page.

Aug 10, 2011 at 2:55 PM

I agree with that, fifteen times wouldn't be fun :)
The maximum nested category count at the moment is 4, which not happens too often, so I think the method should be ok.
I will have a closer look on how to implement this with a user control. I think this will clean up my code a little bit :) thanks for that.

Anyway, I would like to share my current implementation with you. I've made a simple solution which works on the emulator as expected, but on the hardware device some events will not get fired anymore after pressing the back button! I have never had something like this before, and I would like to get to know why... Is it a problem with the emulator, hardware device, framework, or my implementation (which I already kept very simple in this sample).
http://dl.dropbox.com/u/5746496/TestApplication.zip

You can reproduce the issue this way:
- Go to category Page
- Go to category "1 - 2"
- Press the back button
(the navigating event is not firing anymore!)
- Go to category "1 - 2" again
(the selection change event is not firing anymore too!)

If someone could have a look on this, it would be great! :)

In this sample you can see that I manually modify the query string, to store the last shown CategoryId. I have verified, this is not causing problem. I know... this looks ugly and need to be changed anyway...