private void OnMoveNext(object sender, EventArgs e)
{
if ((_ribbonColorButton != null) && (_ribbonColorButton.Ribbon != null))
{
// Cast container to the correct type
KryptonRibbonGroupCluster cluster = (KryptonRibbonGroupCluster)_ribbonColorButton.RibbonContainer;
// Use a transaction to support undo/redo actions
DesignerTransaction transaction = _designerHost.CreateTransaction("KryptonRibbonGroupColorClusterButton 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(_ribbonColorButton) + 1;
index = Math.Min(index, cluster.Items.Count - 1);
cluster.Items.Remove(_ribbonColorButton);
cluster.Items.Insert(index, _ribbonColorButton);
UpdateVerbStatus();
RaiseComponentChanged(propertyItems, null, null);
}
finally
{
// If we managed to create the transaction, then do it
if (transaction != null)
transaction.Commit();
}
}
}