Stopbyte

Navigating back re-creates new Page Instance, how to prevent that?

I am trying to navigate back on my UWP app when users click on the “GoBack()” button they should be taken to the previous page, I did something like this:

this.Frame.Navigate(typeof(MyPreviousPageClass), "frame.navigate");
this.Frame.GoBack();

now the problem is whenever I navigate back to my previous page in the Frame universal windows platform re-creates a fresh page instance, and all my changes on the previous page are lost!

So the question is how can I achieve that the Frame doesn’t re-create my page instance if going back to the previous page?

2 Likes

I found this toolkit for UWP & WinRT it’s pretty much useful.

That toolkit is not the perfect solution though, as it re-implements the entire Paging classes set (Pages, Frames…etc) so maybe should reconsider something else for a production environment.

1 Like