title: Showing a hidden WPF window
body: <h2>In a WPF window I want to hide it, show another window using <code>ShowDialog</code> then unhide the first window.</h2>
  
  <hr>
  
  <p>When I do that:</p>
  
  <pre><code>this.Hide();
  var window2 = new Window2();
  window2.ShowDialog();
  this.Show();
  </code></pre>
  
  <p>The first window open as a blank and empty window.</p>
  
  <p>What's wrong in this technique?</p>
  
  <hr>
  
  <p>When I do that:</p>
  
  <pre><code>var window2 = new Window2();
  Visibility = Visibility.Collapsed;
  window2.ShowDialog();
  Visibility = Visibility.Visible;
  </code></pre>
  
  <p>The first window exits then the application.</p>
  
  <p>What's wrong in this technique too?</p>