public GenerateMdfDrawingsWindow() { InitializeComponent(); ViewModel = new GenerateMdfDrawingsViewModel(); // TODO find a better solution: don't reuse the window, then there's also no need to intercept the closing event. // see http://msdn.microsoft.com/en-us/library/aa972163.aspx // and http://stackoverflow.com/a/848106/2314596 Closing += (sender, e) => { e.Cancel = true; Hide(); }; }