title: How to handle closing window when pressing close icon on the top-right in WPF/MVVM?
body: <p>I am able to bind buttons and menu items with <code>ICommand</code> and close the windows.
  It is exactly as described in the tutorial <a href="http://msdn.microsoft.com/en-us/magazine/dd419663.aspx" rel="nofollow">WPF Apps With The Model-View-ViewModel Design Pattern</a> - via the <code>Command</code> property accessible in XAML.</p>
  
  <p>But it is not described or implemented in the tutorial how to close by pressing the standard 'Close' icon on the top-right of the window. I need to perform some clean up in my application.
  My question is how to bind a <code>Command</code> to the close event, so that it is executed when the user presses the close icon (not buttons or menu items - I know how to manage such cases).</p>
  
  <p>How should this be handled to avoid violating the MVVM approach?
  Thanks!</p>