title: Close the WPF dialog when one clicks on a button inside the WindowsFormHost
body: <p>I have a WPF dialog, that hosts a windowsFormHost control, with something like this</p>
  
  <pre><code>&lt;Window x:Class="WPFSort.MainWindow"
          xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
          xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
          xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
          xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
          xmlns:local="clr-namespace:WPFSort"
          mc:Ignorable="d"
          Title="MainWindow" Height="350" Width="525"&gt;
      &lt;Grid&gt;
          &lt;WindowsFormsHost HorizontalAlignment="Left" Height="Auto"
                            Margin="87,43,0,0" VerticalAlignment="Top" Width="Auto"&gt;
              &lt;local:SimpleWinControl /&gt;
          &lt;/WindowsFormsHost&gt;
  
      &lt;/Grid&gt;
  &lt;/Window&gt;
  </code></pre>
  
  <p>And for the SimpleWinControl  , it is a WinForm control. When <code>button 1</code> is clicked, I want</p>
  
  <ol>
  <li>The WPF dialog to be closed</li>
  <li><p>And the data <code>importantdata</code> to be "pass out" to the WPF form that calls the WPF dialog?</p>
  
  <pre><code>public partial class SimpleWinControl : UserControl
  {
      public SimpleWinControl()
      {
          InitializeComponent();
      }
  
      public object importantdata;
  
      private void button1_Click(object sender, EventArgs e)
      {
        //how should I write the close and pass the importantdata out
  
      }
  }
  </code></pre></li>
  </ol>