private void OnAddTab(object sender, EventArgs e)
{
// Use a transaction to support undo/redo actions
DesignerTransaction transaction = _designerHost.CreateTransaction("KryptonRibbon AddTab");
try
{
// Get access to the tabs property
MemberDescriptor propertyPages = TypeDescriptor.GetProperties(_ribbon)["RibbonTabs"];
RaiseComponentChanging(propertyPages);
// Get designer to create the new tab component
KryptonRibbonTab page = (KryptonRibbonTab)_designerHost.CreateComponent(typeof(KryptonRibbonTab));
_ribbon.RibbonTabs.Add(page);
RaiseComponentChanged(propertyPages, null, null);
}
finally
{
// If we managed to create the transaction, then do it
if (transaction != null)
transaction.Commit();
UpdateVerbStatus();
}
}