我有全局框架,我有NavigationView。因此,在NavigationView中我创建了本地框架。
<NavigationView
...
<Frame x:Name="ContentFrame">
<Frame.ContentTransitions>
<TransitionCollection>
<NavigationThemeTransition />
</TransitionCollection>
</Frame.ContentTransitions>
</Frame>
</NavigationView>
为了导航到页面,我使用这样的人:
switch (item.Tag)
{
case "home":
ContentFrame.Navigate(typeof(HomePage), ContentFrame);
break;
...
ContentFrame被发送到ViewModel,用于页面内的导航。 当我在此框架中导航时,导航历史在全局框架中不可用。我希望点击全局框架中的backstack按钮返回到本地框架。但它按钮不起作用,因为全局框架没有本地框架的历史记录: Activate BackStack
我该怎么做?
答案 0 :(得分:1)
标题栏后退按钮由SystemNavigationManager.BackRequested
事件处理。
我建议将Frame
存储在NavigationView
某处作为参考 - 例如在App.xaml.cs
中创建一个属性:
public Frame AppFrame { get; set; }
并设置如下:
( Application.Current as App ).AppFrame = frame;
然后在BackRequested
的{{1}}中实施OnLaunched
事件:
App.xaml.cs