By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
440,843 Members | 864 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 440,843 IT Pros & Developers. It's quick & easy.

Editor grayed out in PropertyGrid

P: n/a
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(Syste m.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.

--
Steve
Nov 17 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
I found that by changing the following piece of code that the editor now
picks up.

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

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

--
Steve
"Steve Teeples" wrote:
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(Syste m.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.

--
Steve

Nov 17 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.