System.Windows.Forms.Control Vs System.Windows.Controls
-
Hi all, is there a way to cast a System.Windows.Controls.UserControl (.Net 3) to a System.Windows.Forms.Control (.Net2) ? I have a Plugins system and I'm trying to plug some .Net3 components Assembly l_assembly = Assembly.LoadFrom(AssemblyName); Type l_type = l_assembly.GetType(TypeName, true); Control l_itemControl = Activator.CreateInstance(l_type) as Control; here I catch an Exception when I load a "Custom Control Library (WPF)" Thanks
-
Hi all, is there a way to cast a System.Windows.Controls.UserControl (.Net 3) to a System.Windows.Forms.Control (.Net2) ? I have a Plugins system and I'm trying to plug some .Net3 components Assembly l_assembly = Assembly.LoadFrom(AssemblyName); Type l_type = l_assembly.GetType(TypeName, true); Control l_itemControl = Activator.CreateInstance(l_type) as Control; here I catch an Exception when I load a "Custom Control Library (WPF)" Thanks
lkort wrote:
is there a way to cast a System.Windows.Controls.UserControl (.Net 3) to a System.Windows.Forms.Control (.Net2) ?
No, there isn't. You cannot use a .NET 3.0 component in a .NET 2.0 app. You cannot load two different versions of the .NET CLR runtime into the same process. Also, .NET 2.0 does not support WPF, so you can't do this at all. You can do the opposite though. You can load a component that was developed under .NET 2.0 in a .NET 3.0 runtime app.
A guide to posting questions on CodeProject[^]
Dave Kreskowiak Microsoft MVP Visual Developer - Visual Basic
2006, 2007modified on Friday, February 15, 2008 10:52 AM