I'm trying to close a window while opening a new one, but this.close() is not recognised by the system
private void Insert_Data_Click(object sender, RoutedEventArgs e)
{
MainWindow DataWindow = new MainWindow();
DataWindow.Show();
this.Close();
}
Here it is the class declaration
public partial class Home_autismo : MetroWindow
and the included libraries
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;
Any idea why this.Close() is not recognised?