2012-08-31 72 views
2

我一直跟随本教程的“如何:保护和恢复页面国家对Windows Phone的”在http://goo.gl/ct7ui和代码行的一个发现是:Windows.Navigation.NavigationMode的Windows Phone 7

protected override void OnNavigatedFrom(System.Windows.Navigation.NavigationEventArgs e) 
{ 
    // If this is a back navigation, the page will be discarded, so there 
    // is no need to save state. 
if (e.NavigationMode != System.Windows.Navigation.NavigationMode.Back) 
{ 
    // Save the ViewModel variable in the page's State dictionary. 
    State["ViewModel"] = _viewModel; 
} 
} 

但是视觉工作室似乎并不喜欢这段代码给我下面的错误:

'System.Windows.Navigation.NavigationEventArgs' does not contain a definition for 'NavigationMode' and no extension method 'NavigationMode' accepting a first argument of type 'System.Windows.Navigation.NavigationEventArgs' could be found (are you missing a using directive or an assembly reference?) 

什么我已经搞砸这里有任何想法。现在考虑'e'是System.Windows.Navigation.NavigationEventArgs和if语句之后的位显示System.Windows.Navigation.NavigationMode.Back,我不会为我的生活看到这是如何给出错误

+0

7.0或7.5项目? – Ku6opr

+0

7.5抱歉忘了说 – Defterniko

回答

2

NavigationMode是System.Windows.Navigation中的枚举。尝试加入

using System.Windows.Navigation;