Windows phone 8.1后退按钮始终导航到主屏幕

时间:2014-07-23 18:25:39

标签: c# windows-phone-8.1

我的应用中有很多页面。当我单击后退按钮时,它不会导航到上一页,但会导航到所有应用程序都存在的锁定屏幕。我是否必须编写导航后退按钮的代码?

2 个答案:

答案 0 :(得分:0)

是的,您需要覆盖手机的OnBackKeyPress以处理后退按钮应导航到的位置。

答案 1 :(得分:0)

AddHandler HardwareButtons.BackPressed, AddressOf HardwareButtons_BackPressed

Private Sub HardwareButtons_BackPressed(sender As Object, e As BackPressedEventArgs)
    e.Handled = True
    YourGoBackCode()
End Sub

同样在c#

HardwareButtons.BackPressed += HardwareButtons_BackPressed;

private void HardwareButtons_BackPressed(object sender, BackPressedEventArgs e)
{
   e.Handled = true;
   YourGoBackCode();
}