internal void AddItem(Type type, BorderLayoutRegion region)
{
IDesignerHost host = (IDesignerHost)GetService(typeof(IDesignerHost));
if (host != null)
{
PanelBase item = (PanelBase)host.CreateComponent(type);
if (item != null)
{
InitializeItem(item, region);
IComponentChangeService changeService =
(IComponentChangeService)GetService(typeof(IComponentChangeService));
try
{
changeService.OnComponentChanging(region, TypeDescriptor.GetProperties(region)["Items"]);
region.Items.Clear();
region.Items.Add(item);
}
finally
{
changeService.OnComponentChanged(region, TypeDescriptor.GetProperties(region)["Items"], null,
null);
}
}
this.Tag.SetDirty(true);
this.UpdateDesignTimeHtml();
}
}