private void OnMoveNext(object sender, EventArgs e)
{
if ((_ribbonTab != null) &&
(_ribbonTab.Ribbon != null) &&
_ribbonTab.Ribbon.RibbonTabs.Contains(_ribbonTab))
{
// Use a transaction to support undo/redo actions
DesignerTransaction transaction = _designerHost.CreateTransaction("KryptonRibbonTab MovePrevious");
try
{
// Get access to the RibbonTabs property
MemberDescriptor propertyTabs = TypeDescriptor.GetProperties(_ribbonTab.Ribbon)["RibbonTabs"];
RaiseComponentChanging(propertyTabs);
// Move position of the tab
KryptonRibbon ribbon = _ribbonTab.Ribbon;
int index = ribbon.RibbonTabs.IndexOf(_ribbonTab) + 1;
index = Math.Min(index, ribbon.RibbonTabs.Count - 1);
ribbon.RibbonTabs.Remove(_ribbonTab);
ribbon.RibbonTabs.Insert(index, _ribbonTab);
ribbon.SelectedTab = _ribbonTab;
UpdateVerbStatus();
RaiseComponentChanged(propertyTabs, null, null);
}
finally
{
// If we managed to create the transaction, then do it
if (transaction != null)
transaction.Commit();
}
}
}