Occurs directly after Close is called, and can be handled to cancel window closure.
Assembly: PresentationFramework (in PresentationFramework.dll)
The Close is called, if a window's Close button is clicked, or if the user presses ALT+F4.event is raised when
If an owned window was opened by its owner window using Show, and the owner window is closed, the owned window's event is not raised. If the owner of a window is closed (see Owner), is not raised on the owned window.
If Shutdown is called, the event for each window is raised. However, if is canceled, cancellation is ignored.
If a session ends because a user logs off or shuts down, SessionEnding to implement code that cancels application closure.is not raised; handle
If you want to show and hide a window multiple times during the lifetime of an application, and you don't want to reinstantiate the window each time you show it, you can handle the Hide method. Then, you can call Show on the same instance to reopen it.event, cancel it, and call the
The following example demonstrates a Window that determines whether it needs user intervention to close.
<Window x:Class="CSharp.DataWindow" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Closing="DataWindow_Closing" >
Available since 3.0
Available since 4.0