Reader Level:
Articles

How to Open a Page in a Windows 8 App

By Mahesh Chand on Jan 10, 2013
How to open a page in a Windows Store app
  • 0
  • 0
  • 5586

Navigation in a Windows Store or Windows Store app is achieved using a Frame. 

A Frame can host a new page that you want to open in the main or root page and then the Frame can be displayed in the main page. 

I have a page called BasicPage1 and I want to open it on a button click event handler. 

The following code snippet creates a Frame and navigates to the page:

// Create a Frame for the page
var rootFrame = new Frame();
rootFrame.Navigate(typeof(BasicPage1));

Then I set the content of the current window to the new Frame I just created, as in:

// Place the frame in the current Window and activate it
Window.Current.Content = rootFrame;
Window.Current.Activate(); 

Mahesh Chand

C# Corner founder, 10-times Microsoft MVP, technical author, and software architect. Mahesh authored his first book, A Programmer’s Guide to ADO.NET in C# with APress at the age of 25. C# Corner is a memb... Read more

COMMENT USING