public void AddPanel()
{
IDesignerHost host = (IDesignerHost)GetService(typeof(IDesignerHost));
if (host != null)
{
Panel item = (Panel)host.CreateComponent(typeof(Panel));
if (item != null)
{
IComponentChangeService changeService = (IComponentChangeService)GetService(typeof(IComponentChangeService));
try
{
changeService.OnComponentChanging(layout, TypeDescriptor.GetProperties(layout)["Items"]);
item.Title = "Item";
item.Border = false;
layout.Items.Add(item);
this.ExpandItem(item);
}
finally
{
changeService.OnComponentChanged(layout, TypeDescriptor.GetProperties(layout)["Items"], null, null);
}
}
this.UpdateDesignTimeHtml();
this.Tag.SetDirty(true);
}
}