[英]NavigationService doesn't have a definition
我希望 MainWindow.xaml 中有一个前进按钮,以便在我的历史记录中导航到正确的页面。 这是我添加到我的后退按钮点击的内容:
private void BackClick(object sender, MouseButtonEventArgs e)
{
if (this.NavigationService.CanGoBack)
{
this.NavigationService.GoBack();
}
}
一直显示的错误是
'MainWindow' does not contain a definition for 'NavigationService'
据我所知,我的导入是正确的
using System.Windows;
using System.Windows.Controls;
using System.Windows.Input;
using System.Windows.Navigation;
using System.ComponentModel;
这
this.NavigationService
您的MainWindow
类中不存在属性。 阅读文档以获取更多信息。 您需要访问NavigationService
从Frame
, Page
或NavigationWindow
。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.