【发布时间】:2015-12-18 01:38:40
【问题描述】:
当用户单击手机上的硬件按钮时,我想做一些事情。我有两页。在 App.xaml.cs 中,我添加了以下代码来处理页面之间的导航。
SystemNavigationManager.GetForCurrentView().BackRequested += OnBackRequested;
private void OnBackRequested(object sender, BackRequestedEventArgs e)
{
if (this.Frame.CanGoBack)
this.Frame.GoBack();
}
但是现在当用户单击后退按钮时,我想做其他事情。我该怎么做?
【问题讨论】:
-
不确定你想要什么,但你只需要替换“if (this.Frame.CanGoBack) this.Frame.GoBack();”并在那里设置你的代码。当您单击后退按钮时,将始终调用 OnBackRequested。
-
我可以这样做,但我需要在我的应用程序的每个页面上做不同的事情
标签: c# visual-studio-2015 uwp windows-10-mobile