我一直在关注有关“如何:保留和恢复 Windows Phone 页面状态”的教程,该教程位于 http://goo.gl/ct7ui其中一行代码是这样的:
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;
}
}
但是 Visual Studio 似乎不喜欢这段代码,给我带来了以下错误:
'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,我一生都没有看到这是如何给出错误的
最佳答案
NavigationMode 是 System.Windows.Navigation 中的枚举。尝试添加
using System.Windows.Navigation;
关于c# - Windows.Navigation.NavigationMode Windows Phone 7,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12220861/