Design time nested properties like Size, Location, Font, etc

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Does anyone know how to make a multi-attribute property show in the design
time property window of VS IDE in the same way as .Net controls e.g. the Font
property has a + sign against it and can be expanded to reveal the child
proerties.

I am trying to implement a LineStyle property in a control derived form
UserControl which has child properties such as LineWidth, Colour, etc.
Category attribute is not suitable because this only groups properties, it
does not nest them.

Can anyone point me in the right direction.

many thanks
 
Thanks Rakesh, I think of I've got the haqng of it now.

I have come across another sticking point, however. I have a pop up form
within my control which contains a list box which I wish to poulate both at
design-time and run time. The pop up form is instantiated in the control's
constructor and persists for the lifetime of the parent control being either
hidden or shown as required. When I expose the listbox items collection with
the following code the property appears in the design time property grid but
when I use the collections editor I cannot change any of the values. I can
add new items to the list which persist between sessions but I still cannot
change the list item object. Any suggestions?

private PopUpForm puf = null;

private System.ComponentModel.Container components = null;

public MyControl()
{
// This call is required by the Windows.Forms Form Designer.
InitializeComponent();

puf = new PopUpForm();
}

....

[DesignerS erializationVisibility(DesignerSerializationVisibility.Content)]
public System.Windows.Forms.ListBox.ObjectCollection Items
{
get
{
return puf.ListBox.Items;
}
}

Hope someone can see where I'm being an idiot!

Best wishes.
 
Back
Top