我的应用中有很多页面。当我单击后退按钮时,它不会导航到上一页,但会导航到所有应用程序都存在的锁定屏幕。我是否必须编写导航后退按钮的代码?
答案 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();
}