gpt4 book ai didi

c# - Windows.Navigation.NavigationMode Windows Phone 7

转载 作者:太空宇宙 更新时间:2023-11-03 11:17:27 25 4
gpt4 key购买 nike

我一直在关注有关“如何:为 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/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com