Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>I think it is because you are calling LoadComponent() on what is also your Main Window ( <a href="http://msdn.microsoft.com/en-us/library/system.windows.application.mainwindow.aspx" rel="nofollow">http://msdn.microsoft.com/en-us/library/system.windows.application.mainwindow.aspx</a> ), i.e. the startup uri, in your case Window1. The program is probably entering some loop when you close it because closing a Main Window by default shuts down the Application and your two instances of Window1 are waiting on each other (A.K.A. a deadlock)! Albeit seemingly only after making the Application invisible (so it seems to have closed).</p> <p>If you still must use use LoadComponent() on Window1 I think you would need to not make it your startup uri by changing the StartupUri of your Application:</p> <pre><code>&lt;Application xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" StartupUri="Window1.xaml"&gt; &lt;!-- change this --&gt; &lt;/Application&gt; </code></pre> <p>Or change Application.ShutdownMode ( <a href="http://msdn.microsoft.com/en-us/library/system.windows.application.shutdownmode.aspx" rel="nofollow">http://msdn.microsoft.com/en-us/library/system.windows.application.shutdownmode.aspx</a> ) to OnLastWindowClose:</p> <pre><code>&lt;Application xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" StartupUri="Window1.xaml" ShutdownMode="OnLastWindowClose"&gt; &lt;/Application&gt; </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload