//create new second window ehwn ListBox selection is changed private void ListBox_SelectionChanged(object sender, SelectionChangedEventArgs e) { if (dw == null) { dw = new DW(vm) { Owner = this, WindowStartupLocation = WindowStartupLocation.CenterOwner }; dw.Closed += DW_Closed; dw.Show(); } vm.GetSelectedCourseOffering(); }
private void DW_Closed(object sender, System.EventArgs e) => dw = null;