private void OpenProfileWindow(Profile profile) { void ShowAction() { var win = new ProfileWindow(Context, profile); ProfileWindows.Add(win.ProfileGuid, win); win.Closed += OnProfileWindowClosed; win.Focus(); win.Show(); var restoreFocusDialogClose = RootDialog.GetType().GetField("_restoreFocusDialogClose", System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Instance); restoreFocusDialogClose?.SetValue(RootDialog, null); } Dispatcher.BeginInvoke((Action)ShowAction); }