private void OnAddSep(object sender, EventArgs e)
{
if ((_ribbonGroup != null) &&
(_ribbonGroup.Ribbon != null) &&
_ribbonGroup.RibbonTab.Groups.Contains(_ribbonGroup))
{
// Use a transaction to support undo/redo actions
DesignerTransaction transaction = _designerHost.CreateTransaction("KryptonRibbonGroup AddSep");
try
{
// Get access to the Items property
MemberDescriptor propertyItems = TypeDescriptor.GetProperties(_ribbonGroup)["Items"];
RaiseComponentChanging(propertyItems);
// Get designer to create the new separator component
KryptonRibbonGroupSeparator sep = (KryptonRibbonGroupSeparator)_designerHost.CreateComponent(typeof(KryptonRibbonGroupSeparator));
_ribbonGroup.Items.Add(sep);
RaiseComponentChanged(propertyItems, null, null);
}
finally
{
// If we managed to create the transaction, then do it
if (transaction != null)
transaction.Commit();
}
}
}