why the Frame function Navigate not work in c++ Metro metro style app

Pertanyaan why the Frame function Navigate not work in c++ Metro metro style app

  • Thursday, December 22, 2011 1:13 PM
     
     

    I tested as [Adding pages and navigation] tile in the link

    http://msdn.microsoft.com/en-us/library/windows/apps/hh465045(v=vs.85).aspx

    it was OK in the C# Metro app, But when i create a simple C++ Metro app, the sample procedure not working!

    ???

    I simply create a button, and in the button function,i call the Frame function Navigate as following

    this->TestFram->Navigate("ttttt.BlankPage");

    but it's not work.

All Replies

  • Thursday, December 22, 2011 11:15 PM
    Moderator
     
     

    The most common reason is noted in a tip on that page you referenced:

    "If you're building an app and find that navigation isn't working, make sure you remembered to change your content pages to derive from Page instead of UserControl."

     

    It has an example of the XAML that needs modified in order for Navigate to work correctly.

    From
    <UserControl
    to
    <Page

     

    Thanks,

    -David

  • Friday, December 23, 2011 1:33 AM
     
     

    hi,David, thanks for your reply!

    I'm pretty sure that i have changed

    from

    <UserControl

    to

    <Page

    Is there any other reasons?

    I just do the exactly same procedure in the C# project! and that can work correctly.

  • Monday, July 23, 2012 6:34 AM
     
     

    please try this code..

    TypeName

    pageType = {"page name", TypeKind::Custom};

    this->Frame->Navigate( pageType, this);

  • Friday, August 10, 2012 10:37 AM
     
      Has Code

    Use the following code in your click button function.

    this->Frame->Navigate(pagename::typeid,this);
    this code works for me in c++ for navigating page.
  • Saturday, September 01, 2012 12:51 AM
     
      Has Code

    Use the following code in your click button function.

    this->Frame->Navigate(pagename::typeid,this);
    this code works for me in c++ for navigating page.
    This is the best practical solution for C++. Thanks.