I have a very simple UserControl (derived from
System.Windows.Forms.UserControl) that contains several ListViews. The
UserControl exposes a single public property:

public ListView.ColumnHeaderCollection Columns { get {...} };

When I use VS2005 designer's proprtygrid for that UserConrol to add new
Colums to the Collection everything works fine: The form that contains
the UserControl gets new members ( private
System.Windows.Forms.ColumnHeader columnHeader1, ...) in the
UserControl.Designer.cs also initializes each ColumnHeader inside
InitializeComponets().

There is one thing though that the designer fails to do: it does not
add the necessary:

this.userControl1.Columns.AddRange(new
System.Windows.Forms.ColumnHeader[]
{this.columnHeader1,this.columnHeader2,...});

into the InitializeComponent() Method in the UserControl.Designer.cs.

What do I need to do to make that happen ?

Re: adding designtime support for property of usercontrol (InitializeComponents) by Claes

Claes
Thu Aug 17 10:11:06 CDT 2006

Try adding the DesignerSerializationVisibility attribute

[DesignerSerializationVisibility(DesignerSerializationVisibility.Content)]
public ListView.ColumnHeaderCollection Columns
{
get {...}
}

/claes

"bonk" <schwertfischtrombose@gmx.de> wrote in message
news:1155744288.436700.137050@m73g2000cwd.googlegroups.com...
>I have a very simple UserControl (derived from
> System.Windows.Forms.UserControl) that contains several ListViews. The
> UserControl exposes a single public property:
>
> public ListView.ColumnHeaderCollection Columns { get {...} };
>
> When I use VS2005 designer's proprtygrid for that UserConrol to add new
> Colums to the Collection everything works fine: The form that contains
> the UserControl gets new members ( private
> System.Windows.Forms.ColumnHeader columnHeader1, ...) in the
> UserControl.Designer.cs also initializes each ColumnHeader inside
> InitializeComponets().
>
> There is one thing though that the designer fails to do: it does not
> add the necessary:
>
> this.userControl1.Columns.AddRange(new
> System.Windows.Forms.ColumnHeader[]
> {this.columnHeader1,this.columnHeader2,...});
>
> into the InitializeComponent() Method in the UserControl.Designer.cs.
>
> What do I need to do to make that happen ?
>