2
votes

In our WPF application We open one window for authentication as showdialog and set owner as Mainwindow. After authentication we open another window as showdialog and set owner as Mainwindow then close the previous window using coding. When close the second window manually, the focus changed automatically to some other applications. Any help on this is highly appreciated.

Thanks

1
Could you show the code? - user1562155

1 Answers

0
votes

To avoid all trouble with MessageBox class, always show message box from dispatcher thread and set it's owner window properly.

MessageBox class uses Win32 api with the same name, and it should not be called from background threads.

In this case, simple Dispatcher.Invoke call will fix the issue.