public Window6() { this.InitializeComponent(); var vm = new Window6ViewModel(); this.Closed += (s, e) => vm.Close(); this.DataContext = vm; }