I am using the propertygrid with a class and associated type converter. When I moved the class and the TypeConverter to a dll, it seems that it is not being called. Can't find how to activate the typeconverter f开发者_StackOverflowrom a dll.
Assembly a = Assembly.LoadFile(modulepath + elementname + ".dll");
try
{
object myobj = a.CreateInstance(objectname);
Type objecttype = myobj.GetType();
}
Appreciate any hints. Thank you.
It could be because Assembly.LoadFile loads the file in a different binding context from the rest of your code.
Do you have something like this in place on your class:
[TypeConverter(typeof(MyClassConverter))]
public class MyClass {
// Insert code here.
}
Usually as long as the class has the typeconverter associated with it it should pick it up.
精彩评论