SubComponent to appear in main component's properties?

  • Thread starter Thread starter Glenn Shukster
  • Start date Start date
G

Glenn Shukster

Hi
In Delphi a call to SetSubComponent will expose all of a subcomponents
properties and events at design time to the main component.
Does anyone know how to do this in CSharp?

eg
MyObject
+ MySubObject
click on + and see MySubObject's properties of (Height, Weight, age)

MySubObject
- Height
- Weight
- age

Thanks Glenn
 
Hi,

I am not sure this is direct equivalent to Delphi's SetSubComponent, but, as
far as I remember, if you expose a sub-component through a public property,
you can apply the TypeConverter attribute to that property, specifying
ExpandableObjectConverter as the target type converter.
 
Thank You. That was exactly what I was looking for.
I added the following example just in case anyone else wants to do this.

using System.ComponentModel;

[Description("This Works Now"), Category("MyStuff"),
TypeConverter(typeof(ExpandableObjectConverter))]
public virtual TheSubObject MySubObject
{
get
{
return _MySubObject;
}
}


Dmitriy Lapshin said:
Hi,

I am not sure this is direct equivalent to Delphi's SetSubComponent, but, as
far as I remember, if you expose a sub-component through a public property,
you can apply the TypeConverter attribute to that property, specifying
ExpandableObjectConverter as the target type converter.

--
Sincerely,
Dmitriy Lapshin [C# / .NET MVP]
Bring the power of unit testing to the VS .NET IDE today!
http://www.x-unity.net/teststudio.aspx

Glenn Shukster said:
Hi
In Delphi a call to SetSubComponent will expose all of a subcomponents
properties and events at design time to the main component.
Does anyone know how to do this in CSharp?

eg
MyObject
+ MySubObject
click on + and see MySubObject's properties of (Height, Weight, age)

MySubObject
- Height
- Weight
- age

Thanks Glenn
 
Back
Top