Silverlight的 - 如何从用户控件到正常的网页浏览? [英] Silverlight - How to navigate from a User Control to a normal page?
本文介绍了Silverlight的 - 如何从用户控件到正常的网页浏览?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如果我这样做,用户控件里:
NavigationService.Navigate(新的URI(/ Alliance.xaml,UriKind.Relative));
它说这个错误:
这是对象引用是必需的非静态字段,方法或属性System.Windows.Navigation.NavigationService.Navigate(的System.Uri)
感谢您
嗯,我解决了通过正常的页面作为参数传递给用户控件,所以我能得到的NavigationService。
解决方案
(Application.Current.RootVisual为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);
这篇关于Silverlight的 - 如何从用户控件到正常的网页浏览?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文