我试图同时打开一个新的关闭窗口,但this.close()不被系统识别this.close()不能被识别为法
private void Insert_Data_Click(object sender, RoutedEventArgs e)
{
MainWindow DataWindow = new MainWindow();
DataWindow.Show();
this.Close();
}
这是类声明
public partial class Home_autismo : MetroWindow
和包含的库
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;
using MahApps.Metro.Controls;
using MahApps.Metro.Controls.Dialogs;
任何想法,为什么this.Close()不承认?
你试过'Application.Exit()'? – RandomStranger
你能详细说明一下吗?它在运行时不起作用,甚至不能编译?我的应用程序中有完全相同的代码,这很简单。 'Application.Exit()'在尝试切换窗口时退出不方便的应用程序。 – SilentStorm
还要确保你的xaml文件不是一个用户控件或页面,而是以''
SilentStorm