private void OnDeleteTriple(object sender, EventArgs e)
{
if ((_ribbonTriple != null) &&
(_ribbonTriple.Ribbon != null) &&
_ribbonTriple.RibbonGroup.Items.Contains(_ribbonTriple))
{
// Use a transaction to support undo/redo actions
DesignerTransaction transaction = _designerHost.CreateTransaction("KryptonRibbonGroupTriple DeleteTriple");
try
{
// Get access to the Items property
MemberDescriptor propertyItems = TypeDescriptor.GetProperties(_ribbonTriple.RibbonGroup)["Items"];
// Remove the ribbon group from the ribbon tab
RaiseComponentChanging(null);
RaiseComponentChanging(propertyItems);
// Remove the triple from the group
_ribbonTriple.RibbonGroup.Items.Remove(_ribbonTriple);
// Get designer to destroy it
_designerHost.DestroyComponent(_ribbonTriple);
RaiseComponentChanged(propertyItems, null, null);
RaiseComponentChanged(null, null, null);
}
finally
{
// If we managed to create the transaction, then do it
if (transaction != null)
transaction.Commit();
}
}
}