Search code examples
windows-store-appswindows-store

Navigation to other page using User Control


How can we navigate to other page on click on button in user control in windows store app? I tried by making a new frame object and calling navigate method, but no luck till yet. thanks.


Solution

  • The Frame is a ContentControl that hosts the pages. If you want to navigate back and forth between pages you need to use a single Frame control. The default one is created in the App class in the default Visual Studio templates. You can save the instance reference of that Frame like by having a static property on the App class like: public static Frame RootFrame { get; private set; } and then set it where it is constructed - App.RootFrame = new Frame(). Then you can navigate simply by calling App.RootFrame.Navigate().