locked
How to access a page by clicking a button??

    Question

  • Hi,

    I know it is a simple question, I know how to do it in C++ Windows Forms where you do:

    DialogBox^ box = gcnew DialogBox();

    box->ShowDialog();

    But I don't know how to do it in a C++ Metro App, so if anyone can help me I'd appreciate it

    Thanks,

    Regards,

    Omar.


    Friday, June 8, 2012 3:58 AM

Answers

All replies

  • You may want to review the UI guidelines to make sure you choose the appropriate method for displaying the equivalent of a DialogBox in a Metro style app.

    Choosing the right UI surface (Metro style apps)

    We have a number of samples you can review, simply search on the type of UI element you would like to see an example of: Windows 8 Metro style app Samples

    Thanks!


    David Lamb

    Friday, June 8, 2012 9:37 PM
    Moderator
  • Hi David,

    Thanks for your reply.

    I think I didn't explain my question very well, I have 2 pages in my project, in the main page I have a button and I want it so when the user clicks the button it will display the second page.

    Thanks,


    Omar



    Friday, June 8, 2012 10:03 PM
  • Ah, got it. I think this Quickstart should demonstrate how to accomplish that task. Quickstart: Navigating between pages (Metro style apps using C#/VB/C++ and XAML)

    Let me know if that doesn't demonstrate what your trying to accomplish.


    David Lamb


    Saturday, June 9, 2012 12:43 AM
    Moderator
  • Thank you so much David, this helped me a lot.

    Do you know if it is possible to do it with C++ because it didn't show the code for it, if not I will just do my project in C#.

    Thanks for the help.


    Omar


    Saturday, June 9, 2012 9:14 PM
  • In C++, use this syntax:

    #include "BasicPage2.xaml.h" 
    
    
    {
    using namespace Windows::UI::Xaml::Interop;
    
    this->Frame->Navigate( TypeName(BasicPage2::typeid) );
    }
    

    • Marked as answer by iRaQiTechGuy Sunday, June 10, 2012 11:11 PM
    Sunday, June 10, 2012 5:03 PM
  • Ok, thank you so much.

    Omar


    Sunday, June 10, 2012 11:10 PM