title: How to add WinForm User Control Into WPF so that I can reference it in the xaml.cs file
body: <p>I am migrating part of a WinForms project into WPF.</p>
  
  <p>I want to add an existing WinForms User Control into a WPF Form. The WinForm user control is called "TicketPrinter" and lives in the same project as the WPF form.</p>
  
  <p>In my xaml I have this line:</p>
  
  <pre><code>xmlns:Printers="clr-namespace:Project.UserControls.Printers"
  </code></pre>
  
  <p>And then I use it in my xaml here:</p>
  
  <pre><code>        &lt;WindowsFormsHost Height="430" HorizontalAlignment="Left" Margin="468,12,0,0" Name="windowsFormsHost1" VerticalAlignment="Top" Width="324"&gt;
              &lt;Printers:TicketPrinter Printers:Name="ZapTicketPrinter"&gt;
              &lt;/Printers:TicketPrinter&gt;
          &lt;/WindowsFormsHost&gt; 
      &lt;/Grid&gt;
  &lt;/Window&gt;
  </code></pre>
  
  <p>When I run the project the user control appears on the form as expected.</p>
  
  <p>But when I go into the code behind xaml.cs file and try to access "ZapTicketPrinter" it is not available as a reference.</p>
  
  <p>i.e.</p>
  
  <p>I try using ZapTicketPrinter and it's not recognised.</p>
  
  <p>I've also tried the following:</p>
  
  <pre><code>TicketPrinter ticketPrinter = this.FindName("ZapTicketPrinter") as TicketPrinter;
  </code></pre>
  
  <p>but get a null</p>
  
  <p>What am I missing? 
  How do I reference the name in my code?</p>