locked
Why does Frame.Navigate fail silently if I delete my (unused) MainPage.xaml file? RRS feed

  • Question

  • As the question indicates, whenever I try to delete MainPage.xaml from my project (it is not used) the first rootFrame.Navigate() call inside of the OnLaunched methods returns false.  I've attached a simple sample project which demonstrates the problem on my machine (and was reproducible on my coworker's).  The project loads its view from an external DLL and disregards the MainView file.  If you run the project as is, you will notice that the MainViewTwo view appears with "HELLO WORLD" in the top left.  Now try deleting the MainView.xaml file from the startup project.  The MainViewTwo view no longer appears (Navigate returns false).  Could somebody explain this?

    This is the example project:

    http://sdrv.ms/1aQ4v6m (MultiDLLTest)






    • Edited by Jim Borden Tuesday, November 26, 2013 10:10 AM
    Tuesday, November 26, 2013 5:58 AM

All replies

  • Hi Jim,

    I will download and have a look.

    Thanks !

    Sagar

    Tuesday, November 26, 2013 8:51 AM
  • Hi Jim,

    I don't think the sample attached is the one that explains the problem you're referring to.

    To answer your question,

    The documentation for Frame.Navigate() method states :

    Currently, you must handle the NavigationFailed event to respond to navigation failure. You can handle the failure directly in the event handler, or you can set the NavigationFailedEventArgs.Handled property to true and use the Navigate method return value to respond to the failure.

    If that didn't help, can you please share the relevant sample and exact steps to replicate the issue ?

    Thanks !

    Sagar

    Tuesday, November 26, 2013 9:10 AM
  • Sorry, I seem to have gotten my links mixed up.  This is the correct one.  I will edit the original post as well:

    http://sdrv.ms/1aQ4v6m (MultiDLLTest)

    I am handling the NavigationFailed event.  It doesn't come in this case.



    • Edited by Jim Borden Tuesday, November 26, 2013 10:10 AM
    Tuesday, November 26, 2013 9:16 AM
  • I am not sure if you'd got a chance to try this - but if you add ANY XAML page to the project, then the navigation will work. You should be able to make the navigation work-able by adding a Blank XAML page to project.

    -Sagar

    Wednesday, December 4, 2013 4:28 AM
  • I know that it will work if I keep MainPage.xaml there, but why do I have to do that?  I am not trying to navigate to MainPage.xaml, I am trying to navigate to MainPage2.xaml so why do I need MainPage.xaml and why does the method return false without firing the failed event.  It seems like a bug to me.  Were you able to reproduce the problem on the sample I provided?  First I want to confirm that it has nothing to do with my machine setup or my coworker's.
    Wednesday, December 4, 2013 7:08 AM
  • Yes. I was able to replicate the problem and it doesn't seem like a problem with your machine/environment. I will need to check if its a bug.

    -Sagar


    Wednesday, December 4, 2013 9:00 AM