title: Event Handling in WPF
body: <p>There is a button <code>btn_Edit</code> in a window. When that button clicked, a new window opens (<code>new_win</code>) and a click event is added to a button (<code>btn_OK</code>) on <code>new_win</code>. It seems that <code>btn_OK_Click</code> does not work because <code>new_win</code> does not close. Where is the problem?</p>
  
  <pre><code>    BC_edit new_win = new BC_edit();
  
      private void btn_Edit_Click(object sender, RoutedEventArgs e)
      {            
          new_win.Title = "a_title";
          new_win.ShowDialog();
  
          new_win.btn_OK.Click += new RoutedEventHandler(btn_OK_Click);            
      }
  
      private void btn_OK_Click(object sender, RoutedEventArgs e)
      {
          _MyCollection.Add(new MyData
          {
              Boundary = new_win.Title,
              Type = new_win.cmb_BC_edit_type.SelectedItem.ToString(),
              Option = new_win.cmb_BC_edit_options.SelectedItem.ToString()
          });
  
          new_win.Close();
      }
  </code></pre>