Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>The problem you encounter comes from the way, WPF manages the shutdown.</p> <p><strong>You can change the shutdown-behaviour</strong> through the ...</p> <pre><code>Application.Current.ShutdownMode </code></pre> <p>... property. Change it to an approriate value:</p> <pre><code>Application.Current.ShutdownMode = System.Windows.ShutdownMode.OnLastWindowClose; </code></pre> <p>this will help.</p> <p><strong>Another way</strong> is to set manually the <code>MainWindow</code>-property to your second window.</p> <p>If you want to make a <strong>splashscreen</strong> only, use the splashscreen option that is available since .net 3.51. IT has the advantage that it is loaded very early in the application loading sequence, much earlier that a window can. </p> <p>To do that, open the properties-tab of an image in your project-explorer and set the <strong>Build Action</strong> to <strong>SplashScreen</strong></p> <hr> <p><strong>Update</strong></p> <p>In one of my apps I had a design that also had to show a modal dialog before showing the main window. At this time I didn't knew about the <code>ShutdownMode</code>-property.</p> <p>What I did was I first started a <code>Window</code> that was invisible to the user. This was the first window and it also controled app-livetime (default behaviour of WPF). Out from this window I opened the desired dialog (a window that was showed modal). If this dialog has completed unsuccessfull, I terminated the hidden window and the app completetely closed. If the dialog resulted ok, I created the first MainWindow-instance, the user can work with.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

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