Editor grayed out in PropertyGrid

G

Guest

I have class that also uses a custom editor that, when compiled directly into
my project, works just fine in a propertygrid. However, it was necessary to
place that class into a DLL, hense the editor was also moved into the DLL and
compiled. The issue I have is the the editor is now inactive. Can someone
tell me why this may be?

Here is the code for the property in my class that uses the editor. This
code resides within the DLL.

/// <summary>
/// This is the core WMI data that is being checked.
/// </summary>
[Description("Inspects WMI data on the system."),
Category("Data")
Editor(typeof(TestingWmi.MyWMIEditor),typeof(System.Drawing.Design.UITypeEditor)),
DefaultValue(null), Browsable(true)]
public TestingWmi.WMIData MyWMIData
{
get { return this.wmiData; }
set { this.wmiData = value; }
}

The following code instanciates an instance of the class (which references
the editor) within this dll. This method exists within my main program.

public object CreateClassInstance(Assembly dllAssembly, string strType)
{
// Get a reference to the default constructor.
System.Type componentType = dllAssembly.GetType(strType);
if (componentType != null)
{
// Get the default constructor for this derived class of
PropertyBase.
ConstructorInfo constructorInfoObj =
componentType.GetConstructor(Type.EmptyTypes);
// Invoke the constructor.
object cinfo = constructorInfoObj.Invoke(null);
return cinfo;
}

return null;
}

I'd like to understand why the editor, when called from within the DLL is
inactive, but when called directly from within the code, it is active.
 
G

Guest

I found that by changing the following piece of code that the editor now
picks up.

Editor("TestingWmi.MyWMIEditor",typeof(System.Drawing.Design.UITypeEditor)),

Instead of using the typeof(...) I used the string reference to the editor.
Does anyone understand why this would make a difference?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top