问题是,当在另一个XAML页面中使用XAML页面时,如何加载两个页面的已保存状态?
详情
为了使我的ProfilePage.xaml
简单且可重复使用,我已经单独创建它并在MainPage.xaml
的枢轴内使用它(这是一个好方法吗?)
<Grid>
<Pivot>
<PivotItem>
<Grid/>
</PivotItem>
<PivotItem>
<Frame x:Name="ProfileFrame"/>
</PivotItem>
</Pivot>
</Grid>
加载MainPage
后,ProfileFrame
导航到ProfilePage.xaml
:
this.ProfileFrame.Navigate(typeof(ProfilePage), parameter);
每个页面使用NavigationHelper正常保存状态
private void NavigationHelper_SaveState(object sender, SaveStateEventArgs e)
{
e.PageState["collection"] = collection;
}
问题是MainPage
保存状态,然后再次返回MainPage
时,需要创建新的ProfilePage
,而不加载旧的已保存数据。
如何在ProfilePage.xaml
的帧控制中使用MainPage.xaml
时加载状态?