GroupedItemsPage: View jumps back to start when navigating back from detailpage

半世苍凉 提交于 2019-12-06 11:44:07

问题


I developed a quite popular news app for a newspaper. Unfortunately, my users reported the following problem that I can reproduce:

The App basically consists of a GroupedItemsPage and a ItemDetailPage (and several other pages, not important here). The GroupedItemsPage shows the news grouped by category. As the user scrolls to the right, he clicks on one of the items of interests, gets redirected to the ItemDetailPage and navigates back. Back on the GroupedItemsPage the view jumps back to the first group and does not stay at the last position (group) the user has been. The exact same behaviour can be found (in my environment) when I create a new Windows Store "Grid App".

Unfortunately, I was not able to resolve this problem on my own, nor have I found some useful comments in the web. I saw several other apps who could solve this issue and others didn't. Any comment would be very much appreciated. Thank you!


回答1:


You need to implement this by your self. When navigating from GroupedItemsPage to ItemDetailPage you need to remember the click item. Then, when you navigate back to GroupedItemsPage you need to scroll to the remembered item. You can do it by using the ScrollIntoView method on your GridView.




回答2:


I found another, easier solution. I'd like to share it:

In the GroupedItemsPage (XAML) i added:

<common:LayoutAwarePage
NavigationCacheMode="Enabled" ...


来源:https://stackoverflow.com/questions/14605103/groupeditemspage-view-jumps-back-to-start-when-navigating-back-from-detailpage

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!