Sub Properties in Designer

  • Thread starter Thread starter msnews.microsoft.com
  • Start date Start date
M

msnews.microsoft.com

I have a class Order that contains a set of properties for my OrderControl
control.

Instead of creating separate properties in OrderControl for every property
in Order, I just wanted to make Order a property and then let the user set
any properites within Order via the designer.

But I don't get that plus mark. All I get is a string.

Was wondering ... how to I force the designer to get a plus mark so I can
edit those individual properties?
 
Try adding the DesignerSerializationVisibility attribute to the Order
property:

[DesignerSerializationVisibility(DesignerSerializationVisibility.Content)]
public Order Order
{
get { return order; }
}

HTH;
Eric Cadwell
http://www.origincontrols.com
 
I've just spent the whole day playing around with ExpandableObjectConverter,
so I know how frustrating it can be.
The ExpandableObject Class is simple enough to implement as is getting the
properties to serialize. The tricky part is getting the properties to
deserialize when you reset a property.

I won't go into it all here. If you take a look at my Office Style Menu Code
you should find the solution. Just look at the ItemColors property and
#Region " Expandable Object Convertor "
http://dotnetrix.co.uk/menus.html

You may also want to look at:
{http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dndotnet/h
tml/vsnetpropbrow.asp?frame=true}
 
OK, thanks both of you for the posts. Here is where I am at. I really just
wanted to expose all the properties an object that I added to a control. The
simplest way to do that is ...

Add this to your property:

[TypeConverter(typeof(IndicationTypeConverter))]

[DesignerSerializationVisibility(DesignerSerializationVisibility.Content)]
public Indication Indication { ... }

Then create a class like this:

public class IndicationTypeConverter : ExpandableObjectConverter {}

That's it.

There is a whole world of ConvertFrom and ConvertTo ... that are great if
your object needs them, but for me, I just wanted to expose the properties,
and this did the job just fine!
 
Back
Top