[英]navigate to page in user control (metro app win8)
I have add usercontrol and I want to navigate different pages in user control , 我已经添加了usercontrol,并且想要浏览用户控件中的不同页面,
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));
和
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. 你好,阿里,你可以做的是在App.xaml.cs中定义一个Frame类型的静态变量,并且可以像这样相对于该框架进行导航。.OnLaunched方法中,App.xaml.cs中有一个Frame类型的变量名rootframe像这样将本地变量转换为公共静态变量。
public static Frame RootFrame ;
now in your usercontrol use this RootFrame as a reference to navigate like this.. 现在,在您的用户控件中,可以使用此RootFrame作为参考来进行这样的导航。
App.RootFrame.Navigate((typeof(MainPage)));
hope it will solve your problem.. 希望能解决您的问题。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.