title: Better way to check if window got actually closed
body: <p>I would like to know if there is a better way than the following to check if the window got closed, or if a <code>Closing</code> cancled the closing procedure?</p>
  
  <p>Here we go with my way:</p>
  
  <pre><code>var window = Application.Current.Windows.FirstOrDefault(x =&gt; x is FooWindow);
  if (window != null)
  {
      var gotClosed = false;
      window.Closed += (sender, args) =&gt; gotClosed = true;
      window.Close();
      if (gotClosed == false)
      {
          //Close got cancled, by closing...
      }
  }
  </code></pre>