I added a winforms custom control on my wpf window. The control shows in ui but when i trying to reach it inside code, im getting this error;
"The name 'myCustomControl' does not exist in the current context"
Here is my XAML code;
<WindowsFormsHost Width="300" Height="300" Grid.Row="1">
<my:MyControl Dock="Fill" Name="myCustomControl"></my:MyControl>
</WindowsFormsHost>
Sorry for my english
You have to set
x:Nameinstead ofName.In contrast to WPF, setting the
Nameproperty of a WinForms control does not automatically generate a field to access the control.