locked
[C++][XAML] this->Frame->Navigate problem C++ XAML RRS feed

  • Question

  • The above code does not work. When I debug the app. it's for page navigation.

     The errors appear:

    name followed by  :: must be a class or namespace name

    c2653 - MainPage1 is not a class or namespace name

    c2059 - syntax error

    Tried both of this:

    this->frame->navigate(MainPage1::typeid);

    this->frame->navigate(MainPage::typeid , this);


    • Edited by Fred Bao Wednesday, January 20, 2016 2:57 AM add the tag
    Tuesday, January 19, 2016 12:30 PM

Answers

  • Hello XtremeDevelopers,

    Since you are using C++/CX, where you'll need to create a TypeName helper struct, you can use the typeid as below:

    this->Frame->Navigate(TypeName(BlankPage::typeid));

    Also, do not forget to add the reference to the new page as below in page you would navigate from or it would detect the new page type and throw compile errors:

    #include "BlankPage.xaml.h"

    For other scenarios about using the Navigation, you could check the XAML Navigation sample, download the C++ sample.

    Regards.


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.


    • Edited by Fred Bao Wednesday, January 20, 2016 5:52 AM
    • Proposed as answer by Fred Bao Tuesday, January 26, 2016 8:43 AM
    • Marked as answer by Fred Bao Wednesday, January 27, 2016 2:14 AM
    Wednesday, January 20, 2016 5:39 AM