Export (0) Print
Expand All

Application.Shutdown Method ()

Shuts down an application.

Namespace: System.Windows
Assembly: PresentationFramework (in presentationframework.dll)

public void Shutdown ()
public void Shutdown ()
public function Shutdown ()
You cannot use methods in XAML.

When Shutdown is called, an application stops running. You can handle the Exit event to detect when an application is about to stop running, to perform any appropriate processing.

Shutdown is implicitly called by Windows Presentation Foundation (WPF) in the following situations:

Calling Shutdown explicitly causes an application to shut down, regardless of the ShutdownMode setting. However, if ShutdownMode is set to OnExplicitShutdown, you must call Shutdown to shut down an application.

NoteImportant:

When Shutdown is called, the application will shut down irrespective of whether the Closing event of any open windows is canceled.

This method can be called only from the thread that created the Application object.

The Application Shutdown Sample shows both implicit and explicit use of Shutdown to shut down an application, and how the Closing event of a Windows is ignored.

  • UIPermission  for permission to use all windows and user input events without restriction. Associated enumeration: AllWindows

Windows 98, Windows Server 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

The Microsoft .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.

.NET Framework

Supported in: 3.0

Community Additions

ADD
Show:
© 2015 Microsoft