我正在为Windows Phone 8开发一个有2页的小应用程序(1当然是主页)。
当达到 page2 时,我想通过按手机上的后退按钮来检查是否已到达此页面。我想做这样的事情:
protected override void OnNavigatedTo(System.Windows.Navigation.NavigationEventArgs e)
{
if (backButton.isPressed()) {
// this page has been reached by pressing the back button on the phone
} else {
// this page has been reached by NavigationService.Navigate()
}
}
是否有原生API可以做到这一点?
答案 0 :(得分:3)
这是你需要的吗?
protected override void OnNavigatedTo(NavigationEventArgs e)
{
if (e.NavigationMode == NavigationMode.Back)
{
...
}
}