2011-01-05 32 views
1

我有这个问题。我无法退出MainPage中的应用程序。如何解决WP7中的循环导航问题或回路问题?

我开始从导航的MainPage - >第2页--->第3页。

在第三页,我用的NavigationService去炫魅广东。有人可以帮助我吗?

另外我对此术语感到困惑e.cancel = true或false覆盖BackKeyPress事件。

1.)e.Cancel = true表示取消回退?或取消什么? 2)e.cancel = false,?

3)我是否需要重写MainPage中的backKey?

protected override void OnBackKeyPress(System.ComponentModel.CancelEventArgs e) 
    { 
     try 
     { 
      base.OnBackKeyPress(e); 

      if (NavigationService.CanGoBack) 
      { 
       e.Cancel = true; // yes cancel the default behavior ?? 
       NavigationService.GoBack(); 
      } 

     } 
     catch (Exception ex) 
     { 
      // MessageBox.Show("Error : " + ex.Message); 
     } 
    } 

3)此探针的任何解决方法?

谢谢

回答

6

您需要Non-Linear Navigation Service

它是专为这种情况而设计的。只需从Page3导航回MainPage,它就会为您整理后端堆栈。没有必要手动触发对GoBack()等的额外呼叫。