今天写WP7 之前页面跳转真正常,页面路径也正确
但是就是报错 调试后发现总跳到
private void Application_UnhandledException(object sender, ApplicationUnhandledExceptionEventArgs e)
{
if (System.Diagnostics.Debugger.IsAttached)
{
// An unhandled exception has occurred; break into the debugger
System.Diagnostics.Debugger.Break();
}
}
后来发现是是由于 一开始 直接调试页面时
private void CompleteInitializePhoneApplication(object sender, NavigationEventArgs e)
{
// Set the root visual to allow the application to render
if (RootVisual != RootFrame)
//RootVisual = RootFrame;
RootVisual=new MainPage();
// Remove this handler since it is no longer needed
RootFrame.Navigated -= CompleteInitializePhoneApplication;
}
没有用到 RootFrame,因而NavigationService.Navigate 会产生异常