title: WPF hosting a WinForm, Tab Navigation problems
body: <p>I have run into issues when hosting a WinForms form within a <code>WindowsFormsHost</code> and the tab navigation. To solve I have made this simple example:</p>
  
  <ul>
  <li>Created WPF <code>Window</code> (starting point of app)</li>
  <li>Created WinForms <code>Form</code> with two <code>TextBox</code> on it</li>
  <li>WPF window: Added <code>WindowsFormsHost</code> to it</li>
  <li>WPF window: Added <code>OnLoaded</code> handler</li>
  <li>WPF window: Added <code>Textbox</code> positioned under the <code>WindowsFormsHost</code></li>
  </ul>
  
  <p>In the <code>OnLoaded</code> handler I got:</p>
  
  <pre><code>System.Windows.Forms.Form f = new WinFormsForm();
  f.TopLevel = false;
  f.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None;
  this.windowsFormsHost1.Child = f;
  </code></pre>
  
  <p>When I now run the application:</p>
  
  <ul>
  <li>Nothing is focussed (ok)</li>
  <li>I click on the first <code>TextBox</code> in the <code>WindowsFormsHost</code>, it gets focus (ok)</li>
  <li>I press tab, focus goes to 2nd <code>TextBox</code> in the <code>WindowsFormsHost</code> (ok)</li>
  <li>I press tab again, focus goes back to 1st <code>TextBox</code> in the <code>WindowsFormsHost</code> (<strong>not</strong> ok; should have left <code>WindowsFormsHost</code> and given focus to the textbox at the bottom of the WPF window)</li>
  <li>I click on the textbox in the wpf (placed after and under the <code>WindowsFormsHost</code>), it gets focus (ok)</li>
  <li>I press tab, focus goes to 1st textbox in <code>WindowsFormsHost</code> - as it should go to beginning after the end. So this is ok too</li>
  <li>I click the wpf textbox again and press shift+tab, focus goes to 2nd textbox in <code>WindowsFormsHost</code> (ok)</li>
  <li>I press tab, focus goes to 1st textbox in <code>WindowsFormsHost</code> (goes to beginning in WFH) (<strong>not</strong> ok)</li>
  </ul>
  
  <p>How do I make the focus behave like if I had only controls of one type? Meaning a tab order of WFH-1st-Textbox, WFH-2nd-Textbox, WPF-Textbox in this case.</p>