private void ChangeThemeClicked(object obj) { if (currentThemeWindow != null) { currentThemeWindow.Show(); return; } var themePopup = new ThemeSwitcher_UC() { DataContext = switcherVM }; IWindow window = shell.CreateWindow(themePopup, "Switch theme"); currentThemeWindow = window; switcherVM.CloseClicked += (s, e) => window.Close(); window.Closed += (s, e) => currentThemeWindow = null; window.Show(); }