Home » C# » How to back to the last hub section from current page?

How to back to the last hub section from current page?

You have a Windows Universal App (XAML / C#) with a Hub as its main page. Users can explore different parts of the app from the hub sections.

When the users return to the main page they are not by default taken back to the same hub section where they left off but instead to the default hub section (the “first” one). That is a bit ugly in terms of user experience as it breaks the flow.

There is one way to take the user back to the last visited section by changing the DefaultSectionIndex.

Problem with that approach is that it changes the composition of the main page – the respective section becomes the leftmost section, and header and background picture align with that.

There is a way to return the user to the last viewed section without changing the order of the sections:

Set the page’s NavigationCacheMode=”Required” either in XAML or code behind.

About

Informatics - my job & my passion.