private void OnMoveFirst(object sender, EventArgs e)
{
if ((_ribbonGallery != null) &&
(_ribbonGallery.Ribbon != null) &&
_ribbonGallery.RibbonGroup.Items.Contains(_ribbonGallery))
{
// Use a transaction to support undo/redo actions
DesignerTransaction transaction = _designerHost.CreateTransaction("KryptonRibbonGroupGallery MoveFirst");
try
{
// Get access to the Items property
MemberDescriptor propertyItems = TypeDescriptor.GetProperties(_ribbonGallery.RibbonGroup)["Items"];
RaiseComponentChanging(propertyItems);
// Move position of the gallery
KryptonRibbonGroup ribbonGroup = _ribbonGallery.RibbonGroup;
ribbonGroup.Items.Remove(_ribbonGallery);
ribbonGroup.Items.Insert(0, _ribbonGallery);
UpdateVerbStatus();
RaiseComponentChanged(propertyItems, null, null);
}
finally
{
// If we managed to create the transaction, then do it
if (transaction != null)
transaction.Commit();
}
}
}