I'm currently developing my own TabControl and I am struggling to make it designer friendly.
My control is made of a class like this:
public class GlassTabControl : UserControl
{
private GlassTabPageCollection _tabList = new GlassTabPageCollection();
[Browsable(true)]
public GlassTabPageCollection TabPages
{
get { return _tabList; }
set { _tabList = value; }
}
}
After adding my GlassTabControl on a Form and adding a GlassTabPage to my collection through VS2010 designer I found the exact code in MyForm.Designer.cs:
this.glassTabControl1.Location = new System.Drawing.Point(12, 80);
this.glassTabControl1.Name = "glassTabControl1";
this.glassTabControl1.Size = new System.Drawing.Size(352, 257);
this.glassTabControl1.TabIndex = 0;
this.glassTabControl1.TabMinimumHeight = 25;
new GlassTabControlUI.TabPagesCollection().Add(this.glassTabPage1);
As you can see the last line makes no sense and if I replace it with:
this.glassTabControl1.TabPages.Add(this.glassTabPage1);
works perfectly.
Sorry for such a long post and I'm eager to hear your opinion on why that code is generated.
PS: I tried cleaning the solution, restarting VS, etc.
Thanks,
Alex