我正在尝试访问Windows Phone的模糊事件,因为我需要访问rootframe。我正在开发一款Windows phone Silverlight 8.1 app。我的代码是:
public MainPage()
{
InitializeComponent();
(Application.Current as App).RootFrame.Obscured += OnObscured;
(Application.Current as App).RootFrame.Unobscured += OnUnobscured;
}
上面的代码给出了错误“'calltest.App.RootFrame.get'无法使用实例引用访问;请使用类型名称限定它”。怎么了?
答案 0 :(得分:2)
RootFrame
是静态的,因此请将代码替换为:
App.RootFrame.Obscured += OnObscured;
App.RootFrame.Unobscured += OnUnobscured;