Manually closes a Window.
Assembly: PresentationFramework (in PresentationFramework.dll)
A Window can be closed using one of several, well-known, system-provided mechanisms located in its title bar, including:
System menu | Close.
A Window can also be closed using one of several well-known mechanisms within the client area that are provided by developers, including:
File | Exit on a main window.
File | Close or a Close button on a child window.
These mechanisms require you to explicitly call to close a window.
If a window, opened by calling ShowDialog, and with a Button with its IsCancel property set to true, will automatically close when the button is either clicked, or ESC is pressed. If the window was opened using Show, however, must be explicitly called, such as from Click event handler for the Button.
The Closed event is raised.
Unmanaged resources created by the Window are disposed.
This method cannot be called when a window is hosted in a browser.
Windows 8.1, Windows Server 2012 R2, Windows 8, Windows Server 2012, Windows 7, Windows Vista SP2, Windows Server 2008 (Server Core Role not supported), Windows Server 2008 R2 (Server Core Role supported with SP1 or later; Itanium not supported)
The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.