问题描述:

I am working on a Windows Phone 8.1 RT universal app. For my scenario, I have two pages, the first page mainpage.xaml which has a pivot and two pivot items. when I click on a tapped event on a textblock in the second pivot item, I go to the second page. Now if I click the hardware back button, it takes me back to the first pivot item. Shouldn't it take me to the original pivot item where I started my navigation?

I am sure I am missing something very basic here..... :)

Thanks for your help!

网友答案:

Have you tried setting NavigationCacheMode on the Page to Enabled? This way the page should be cached so when you go back, the second PivotItem should remain selected.

<Page
    x:Class="App.MainPage"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:local="using:App"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    mc:Ignorable="d"
    NavigationCacheMode="Enabled">
相关阅读:
Top