Silverlight的 - 如何从用户控件到正常的网页浏览?控件、网页浏览、正常、用户

由网友(固执的青春)分享简介:如果我这样做,用户控件里:NavigationService.Navigate(新的URI(/ Alliance.xaml,UriKind.Relative));它说这个错误:这是对象引用是必需的非静态字段,方法或属性System.Windows.Navigation.NavigationService.Navigat...

如果我这样做,用户控件里:

  NavigationService.Navigate(新的URI(/ Alliance.xaml,UriKind.Relative));
 

它说这个错误:

Silverlight教程第二部分 使用布局管理 木野狐译

这是对象引用是必需的非静态字段,方法或属性System.Windows.Navigation.NavigationService.Navigate(的System.Uri)

感谢您

嗯,我解决了通过正常的页面作为参数传递给用户控件,所以我能得到​​的NavigationService。

解决方案

 (Application.Current.RootVisu​​al为PhoneApplicationFrame).Navigate(URI);
 

If I do this inside a User Control:

NavigationService.Navigate(new Uri("/Alliance.xaml", UriKind.Relative));

it says this error:

An object reference is required for the non-static field, method, or property 'System.Windows.Navigation.NavigationService.Navigate(System.Uri)'

Thank you

Well, I solved passing the normal Page as an argument to the User Control, so I could get the NavigationService.

解决方案

(Application.Current.RootVisual as PhoneApplicationFrame).Navigate(uri);

阅读全文

相关推荐

最新文章