gpt4 book ai didi

c# - 对象引用未设置为 Windows 8 应用程序中对象的实例

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

因此,在查阅了无数资源以试图找出这真正意味着什么之后,我发现没有任何用处。让我们把它弄清楚,我知道错误是什么意思。但我不知道是什么原因造成的。我的代码如下:

private void Button_Click_1(object sender, RoutedEventArgs e)
{
ListView selector = this.itemListView;
FeedItem item = selector.SelectedItem as FeedItem;
if (item != null && this.Frame != null)
{
this.Frame.Navigate(typeof(WebViewPage), item.Title); //This line is the problem
}
}

我试图做的是根据 itemListView 中的选择导航到完整的 webview 页面。我通过使用 AppBar 按钮来完成此操作。当我逐行执行此代码时,一切都按预期运行,直到我尝试导航。在导航之前,我的所有对象都不为空(根据智能感知和输入 if 语句的事实),并且在我单步执行导航后它仍然保持这种状态。该程序不会失败,它只是在 Intellitrace 框中显示为异常,并且导航从未发生,让用户随心所欲地单击应用栏按钮,但无济于事。

Webview 页面代码(根据 IntelliTrace,我实际上从未访问过此页面中的任何代码)。

protected override void LoadState(Object navigationParameter, Dictionary<String,Object> pageState)
{
FeedItem item = FeedUtilities.GetItemByTitle((string)navigationParameter);
pageTitle.DataContext = item;

itemContentWebView.Navigate(item.Link);
}

这几天一直让我很沮丧,所以非常感谢任何帮助。

最佳答案

试试这个:

var rootFrame = new Frame();
rootFrame.Navigate(typeof(SearchResultsPage1));

Window.Current.Content = rootFrame;
Window.Current.Activate();

关于c# - 对象引用未设置为 Windows 8 应用程序中对象的实例,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13307460/

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