I've a problem with two user controls, first of all I've a user control named "Base" and I want to inherit it from another user control named "MyControl" but the "Base" control is a partial class and the user control "MyControl" just have a public class, so I use a partial class in "MyControl", and I use an ElementHost to show "MyControl" but I've the error "Cannot implicity convert type MyControl to System.Windows.UIElement".
I try to add "MyControl" as a Child but it shows that error.
Help!
Edit: The clases looks like:
public partial class Base : UserControl
{
}
public partial class MyControl : Base
{
}
And I want to do something like this:
public addControl()
{
ElementHost _host = new ElementHost();
_host.Dock = Dockstyle.Fill;
_host.Child = _myControl;
panel.Control.Add(_host);
}
The error is at _host.Child = _myControl;. At this point the object _myControl is initialized.