Closes the application window unless the Closing event is canceled.
Assembly: System.Windows (in System.Windows.dll)
You use this method to provide an alternative to the window Close button. This is particularly useful in trusted applications when you hide the window title bar and border. For information, see How to: Configure an Application for Out-of-Browser Support.
You can call this method only in the following cases:
In response to a user-initiated action, for example, in a button Click event handler.
In a trusted application.
In Silverlight 5, trusted, out-of-browser applications can create multiple Window instances and manipulate them programmatically. When a window is closed either by the user or by the method, the instance is removed from the Windows collection and the instance becomes invalid. If you want to reuse a Window instance, handle the Closing event, set Cancel to true, and then hide the window by setting its Visibility property to Collapsed.