title: Opening new window in WPF throws an exception
body: <p>I have a WPF application with two windows, MainWindow and Window2.
  MainWindow was created by Visual Studio (and then modified by me).
  I then right-clicked on my project and chose Add -> Window.
  I modified the new window XAML and added a button to my main page with this click handler:</p>
  
  <pre><code>    private void OnTest(object sender, RoutedEventArgs e)
      {
          var tst = new Window2();
          tst.Show();
      }
  </code></pre>
  
  <p>Clicking on the button with that handler results in an exception being thrown:</p>
  
  <blockquote>
    <p>System.Windows.Markup.XamlParseException: 'The visual tree has been
    changed during a 'VisualTreeChanged' event.'</p>
  </blockquote>
  
  <p>The line that threw the exception is</p>
  
  <pre><code>tst.Show();
  </code></pre>
  
  <p>Obviously, I'm missing something basic, but I have no idea what it is.</p>