Windows phone 8.1 BackButton导航问题

时间:2015-04-29 12:15:02

标签: c# windows-phone-8

我正在开发Windows phone 8.1 Silver Light应用程序。在应用程序中有很多屏幕。页面正在完美导航。

我的问题是当我按下后退按钮(Windows Phone后退按钮)页面将返回上一页。我想在我的应用程序中停止按钮导航。我按照下面的链接但我没有成功。 https://social.msdn.microsoft.com/Forums/windowsapps/en-us/131a99ce-53a4-4389-81e9-7801af57b78b/used-hardwarebuttonsbackpressed-handler

任何人都可以告诉我。

1 个答案:

答案 0 :(得分:1)

尝试使用XAML.cs页面上的后退按钮:

protected override void OnBackKeyPress(System.ComponentModel.CancelEventArgs e)
{
        base.OnBackKeyPress(e);
        if (NavigationService.CanGoBack)
        {
            while (NavigationService.RemoveBackEntry() != null)
            {
                NavigationService.RemoveBackEntry();
            }
        }
 }