title: How can I close and reopen a window in wpf?
body: <p>I have a wpf application with a button, which opens a new Window, where I want to determine some settings. See following code:</p>
  
  <pre><code>public partial class MainWindow : Window
  {
      private SettingsWindow SettingsWindow;
  
      public MainWindow()
      {
          InitializeComponent();
      }
  
      private void settings_Click(object sender, RoutedEventArgs e)
      {
          if (this.SettingsWindow == null)
          {
              SettingsWindow = new SettingsWindow(); // No reentrace here !!!
          }
          SettingsWindow.Show();
          SettingsWindow.Focus();
      }
  }
  </code></pre>
  
  <p>However, when I close the SettingsWindow and want to reopen it from the MainWindow, the whole application freezes.
  I thought the object would be destroyed at closing and thus initialized newly inside the if-clause.</p>
  
  <p>Do I have to do an override in the SettingsWindow's close routine or did I disregard something else?</p>