Wrong approach! (And there are no pop-ups in WPF, there are dialog and modal windows.)
You need to show dialog or show a window in modal form using
ShowDialog
:
http://msdn.microsoft.com/en-us/library/system.web.httputility.htmlencode.aspx[
^].
After it is done, the calling code should check up the result. With
Window
, you can provide and check up any property you might device to indicate that certain action is requested, but the standard way uses the property
DialogResult
:
http://msdn.microsoft.com/en-us/library/system.windows.window.dialogresult.aspx[
^].
The calling code has the instance of a dialog or a windows after it was shown and eventually closed. At this moment, the calling code can check up the result and act accordingly. For example, it can close the main window of the application of exit the application:
http://msdn.microsoft.com/en-us/library/ms597013.aspx[
^].
That's all. Very easy, and no "close from a popup" needed.
—SA