您的位置:首页 > 移动开发 > Objective-C

WP7 页面导航报错 跳到System.Diagnostics.Debugger.Break

2012-04-17 20:53 387 查看
今天写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 会产生异常
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息