简体   繁体   中英

navigate to page in user control (metro app win8)

I have add usercontrol and I want to navigate different pages in user control ,

I have tried a lot of method like below :

var frame = Window.Current.Content as Frame; frame.Navigate(typeof(Pages.createNewsLetter));

and this.Frame.Navigate(typeof(Pages.createNewsLetter));

hello Ali what you can do is define a Frame type static varible in your App.xaml.cs and can navigate with respect to this frame like this.. there is a Frame type variable name rootframe in your App.xaml.cs in OnLaunched method convert this local variable to public static variable like this.

 public static Frame RootFrame ;

now in your usercontrol use this RootFrame as a reference to navigate like this..

 App.RootFrame.Navigate((typeof(MainPage)));

hope it will solve your problem..

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM