private void OnMovePrevious(object sender, EventArgs e)
{
if ((_ribbonTrackBar != null) && (_ribbonTrackBar.Ribbon != null))
{
// Get access to the parent collection of items
TypedRestrictCollection<KryptonRibbonGroupItem> items = ParentItems;
// Use a transaction to support undo/redo actions
DesignerTransaction transaction = _designerHost.CreateTransaction("KryptonRibbonGroupTrackBar MovePrevious");
try
{
// Get access to the Items property
MemberDescriptor propertyItems = TypeDescriptor.GetProperties(_ribbonTrackBar.RibbonContainer)["Items"];
RaiseComponentChanging(propertyItems);
// Move position of the trackbar
int index = items.IndexOf(_ribbonTrackBar) - 1;
index = Math.Max(index, 0);
items.Remove(_ribbonTrackBar);
items.Insert(index, _ribbonTrackBar);
UpdateVerbStatus();
RaiseComponentChanged(propertyItems, null, null);
}
finally
{
// If we managed to create the transaction, then do it
if (transaction != null)
transaction.Commit();
}
}
}