Hi,
How can I make the TestSettings class (below) browsable/expandable in the property grid, when it acts as a property of EngineSettings
The code below does not work...what might be wrong
[TypeConverterAttribute(typeof(ExpandableObjectConverter))]
[Category("Engine Settings")]
[Description("Settings for the Engine")]
sealed class EngineSettings: ApplicationSettingsBase
{
[UserScopedSetting]
public TestSettings TestSettings
{
get { return (TestSettings)this["TestSettings"]; }
set { this["TestSettings"] = value; }
}
}
[TypeConverterAttribute(typeof(ExpandableObjectConverter))]
internal class TestSettings : ApplicationSettingsBase
{
[UserScopedSetting]
public String Test
{
get { return (String)this["Test"]; }
set { this["Test"] = value; }
}
[UserScopedSetting]
public int Number
{
get { return (int)this["Number"]; }
set { this["Number"] = value; }
}
}
Thanks!

Custom types of ApplicationSettingsBase not expandable in property grid
Sumabobby
VirGin
Oh, you mean like PropertyGrid.SelectedObject = mEngineSettings
-I've already done that, and that's not the problem. The properties of EngineSettings are displayed correctly. I probably haven't explained my problem well enough:
The thing is that I am unable to expand the TestSetting-property of the EngineSettings class. Meaning that if I have custom class types as properties, I am unable to expand this property to change the lower-level properties of TestSetting like the "String Test" property and the "int Number" property.
Only the 1st level properties of EngineSettings are accessible, even when I've set the [TypeConverterAttribute(typeof(ExpandableObjectConverter))] for the TestSetting class.
Any idea why the ExpandableObjectConverter doesn't work when setting PropertyGrid.SelectedObject to an object that inherits ApplicationSettingsBase (If that is actually my problem)
(I have changed both the "sealed" and the "internal" keywords to "public" now)
Thanks again!
Praval Rastogi
Sorry if this is a stupid question, but do you have a code-snippet showing how to bind the EngineSettigns to the property grid
-I haven't managed to figure out how to do that yet...
Paul Huizer
Unable to expand child properties in PropertyGrid using Properties.Settings
Parham.G
hazel_m_stu_o
This code wouldn't complite because the TestSettings class has a internal scope and the EngineSettings.TestSettings property an public scope.