G
Guest
Hi,
I want to allow design time modification of components on a usercontrol. I
added a listview called listView1 to the usercontrol, then added this
accessor method:
[Category("Components"),
Description("Set the listview parameters."),
DesignerSerializationVisibility(DesignerSerializationVisibility.Content)]
public MyListView ListView
{
get { return listView1; }
}
This works great, almost. When the usercontrol is added to a form, I can
edit the ListView properties. Unfortunately, this line of coded is added to
my form's InitializeComponent() method:
this.userListView.Controls.Add(this.listView1.ListView);
I've read that usually you have to expose each property individually, but
exposing the entire control works except for the redundant "Add" above. And
with DesignerSerializationVisibility.Content I didn't expect the control
itself to be serialized, just the contents. If I delete the line above
everything is fine, but of course I don't want to have to edit
InitializeComponent().
Is there a way to eliminate the redundant listview "Add()"?
Thank you,
Gary
I want to allow design time modification of components on a usercontrol. I
added a listview called listView1 to the usercontrol, then added this
accessor method:
[Category("Components"),
Description("Set the listview parameters."),
DesignerSerializationVisibility(DesignerSerializationVisibility.Content)]
public MyListView ListView
{
get { return listView1; }
}
This works great, almost. When the usercontrol is added to a form, I can
edit the ListView properties. Unfortunately, this line of coded is added to
my form's InitializeComponent() method:
this.userListView.Controls.Add(this.listView1.ListView);
I've read that usually you have to expose each property individually, but
exposing the entire control works except for the redundant "Add" above. And
with DesignerSerializationVisibility.Content I didn't expect the control
itself to be serialized, just the contents. If I delete the line above
everything is fine, but of course I don't want to have to edit
InitializeComponent().
Is there a way to eliminate the redundant listview "Add()"?
Thank you,
Gary