我正在尝试访问Windows Phone的模糊事件,因此我需要访问rootframe。我正在使用Windows Phone Silverlight 8.1应用程序。我的代码是:
public MainPage()
{
InitializeComponent();
(Application.Current as App).RootFrame.Obscured += OnObscured;
(Application.Current as App).RootFrame.Unobscured += OnUnobscured;
}
上面的代码给出了一个错误“'calltest.App.RootFrame.get'不能通过实例引用进行访问;而是使用类型名称对其进行限定”。怎么了?
RootFrame
是静态的,因此用以下代码替换您的代码:
App.RootFrame.Obscured += OnObscured;
App.RootFrame.Unobscured += OnUnobscured;
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句