private void OnMoveFirst(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 MoveFirst");
try
{
// Get access to the Items property
MemberDescriptor propertyItems = TypeDescriptor.GetProperties(cluster)["Items"];
RaiseComponentChanging(propertyItems);
// Move position of the button
cluster.Items.Remove(_ribbonButton);
cluster.Items.Insert(0, _ribbonButton);
UpdateVerbStatus();
RaiseComponentChanged(propertyItems, null, null);
}
finally
{
// If we managed to create the transaction, then do it
if (transaction != null)
transaction.Commit();
}
}
}