I've written a custom control which mimics the appearance of a table header. The columns it draws are given by a collection of objects with a Text string property and a Width int property. Both have Browsable, Category, DefaultValue and Description attributes added. In the designer, the collection is editable and the user can set the Text and Width as they would for a control, and the attributes are honoured as I'd hoped. However, the user can't edit the name of the variable; the generated code looks like this:
HeaderMimicColumn headerMimicColumn1 = new HeaderMimicColumn();
HeaderMimicColumn headerMimicColumn2 = new HeaderMimicColumn();
HeaderMimicColumn headerMimicColumn3 = new HeaderMimicColumn();
...
Is it possible to make it so the user can specify the names of the variables used for the columns, in the designer? If so, how?
EDIT: Just to be clear, HeaderMimicColumn doesn't derive from System.Windows.Forms.Control, it's just a plain class with those two properties and a pair of events which fire when they change.
I should probably also explain that the collection has its DesignerSerializationVisibility set to Contents.