//Show details window on button click private void BtnShowDetails_Click(object sender, RoutedEventArgs e) { if (dw == null) { dw = new DetailWindow(vm) { Owner = this, WindowStartupLocation = WindowStartupLocation.CenterOwner }; dw.Closed += Dw_Closed; dw.Show(); } }
//On close, reset dw to null to remove window private void Dw_Closed(object sender, System.EventArgs e) => dw = null;