#55 – Application.ShutdownMode

The WPF Application class has a ShutdownMode property that indicates when an application should terminate, based on which windows are closed.

By default, the value of this property is ShutdownMode.OnLastWindowClose.  This indicates that the application will terminate after you’ve closed all of its windows.

You can also set the property to ShutdownMode.OnMainWindowClose.  When you do this, your application will terminate as soon as you close its main window, which will automatically close any other open windows that the application created.

About Sean
Software developer in the Twin Cities area, passionate about .NET technologies. Equally passionate about my own personal projects related to family history and preservation of family stories and photos.

4 Responses to #55 – Application.ShutdownMode

  1. Sacco says:

    You can also set the property to ShutdownMode.OnExplicitShutdown: when you do this, your application will terminate only when System.Windows.Application.Shutdown().

  2. Pingback: #1,098 – OnLastWindowClose Shutdown Mode | 2,000 Things You Should Know About WPF

  3. Pingback: #1,099 – OnMainWindowClose Shutdown Mode | 2,000 Things You Should Know About WPF

  4. Pingback: #1,100 – OnExplicitShutdown Shutdown Mode | 2,000 Things You Should Know About WPF

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: