I am moving part of the WinForms project to WPF.
I want to add an existing WinForms user control to a WPF form. The WinForm user control is called "TicketPrinter" and lives in the same project as the WPF form.
In my xaml, I have this line:
xmlns:Printers="clr-namespace:Project.UserControls.Printers"
And then I use it in my haml here:
<WindowsFormsHost Height="430" HorizontalAlignment="Left" Margin="468,12,0,0" Name="windowsFormsHost1" VerticalAlignment="Top" Width="324">
<Printers:TicketPrinter Printers:Name="ZapTicketPrinter">
</Printers:TicketPrinter>
</WindowsFormsHost>
</Grid>
</Window>
When I run the project, the user control appears on the form as expected.
But when I go to the code behind the xaml.cs file and try to access "ZapTicketPrinter", it is not available as a link.
i.e.
I am trying to use ZapTicketPrinter and it is not recognized.
I also tried the following:
TicketPrinter ticketPrinter = this.FindName("ZapTicketPrinter") as TicketPrinter;
but we get zero
What am I missing? How do I specify a name in my code?