private void OnMoveLast(object sender, EventArgs e)
{
if ((_ribbonCluster != null) && (_ribbonCluster.Ribbon != null))
{
// Cast container to the correct type
KryptonRibbonGroupLines lines = (KryptonRibbonGroupLines)_ribbonCluster.RibbonContainer;
// Use a transaction to support undo/redo actions
DesignerTransaction transaction = _designerHost.CreateTransaction("KryptonRibbonGroupCluster MoveLast");
try
{
// Get access to the Items property
MemberDescriptor propertyItems = TypeDescriptor.GetProperties(lines)["Items"];
RaiseComponentChanging(propertyItems);
// Move position of the cluster
lines.Items.Remove(_ribbonCluster);
lines.Items.Insert(lines.Items.Count, _ribbonCluster);
UpdateVerbStatus();
RaiseComponentChanged(propertyItems, null, null);
}
finally
{
// If we managed to create the transaction, then do it
if (transaction != null)
transaction.Commit();
}
}
}