Frame.GoBack最小化应用程序

时间:2014-09-17 13:05:40

标签: windows-runtime windows-phone-8.1

public Constructor1()
{
    this.NavigationCacheMode = NavigationCacheMode.Enabled;
}

....

public Constructor2()
{
    this.NavigationCacheMode = NavigationCacheMode.Enabled;
    HardwareButtons.BackPressed += this.MainPage_BackPressed;
}

private void MainPage_BackPressed(object sender, BackPressedEventArgs e)
{
    if(this.Frame.CanGoBack)
    {
        this.Frame.GoBack();
    }
}

在我的Windows Phone上使用BackButton之后,我的应用程序最小化了自己。我必须转到任务管理器并单击它以将其恢复。 有什么建议为什么Frame.GoBack最小化应用程序?

1 个答案:

答案 0 :(得分:2)

private void MainPage_BackPressed(object sender, BackPressedEventArgs e)
{
    if(this.Frame.CanGoBack)
    {
        e.Handled = true;
        this.Frame.GoBack();
    }
}

e.Handled = true; 是问题。