private void OnMoveNext(object sender, EventArgs e)
{
if ((_ribbonButton != null) && (_ribbonButton.Ribbon != null))
{
// Cast container to the correct type
KryptonRibbonGroupCluster cluster = (KryptonRibbonGroupCluster)_ribbonButton.RibbonContainer;
// Use a transaction to support undo/redo actions
DesignerTransaction transaction = _designerHost.CreateTransaction("KryptonRibbonGroupClusterButton MoveNext");
try
{
// Get access to the Items property
MemberDescriptor propertyItems = TypeDescriptor.GetProperties(cluster)["Items"];
RaiseComponentChanging(propertyItems);
// Move position of the triple
int index = cluster.Items.IndexOf(_ribbonButton) + 1;
index = Math.Min(index, cluster.Items.Count - 1);
cluster.Items.Remove(_ribbonButton);
cluster.Items.Insert(index, _ribbonButton);
UpdateVerbStatus();
RaiseComponentChanged(propertyItems, null, null);
}
finally
{
// If we managed to create the transaction, then do it
if (transaction != null)
transaction.Commit();
}
}
}