Silverlight - 如何从用户控件导航到普通页面? [英] Silverlight - How to navigate from a User Control to a normal page?

查看:17
本文介绍了Silverlight - 如何从用户控件导航到普通页面?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如果我在用户控件中执行此操作:

If I do this inside a User Control:

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

它说这个错误:

非静态字段、方法或属性System.Windows.Navigation.NavigationService.Navigate(System.Uri)"需要对象引用

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

谢谢

好吧,我解决了将普通页面作为参数传递给用户控件的问题,这样我就可以获得 NavigationService.

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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆