private void OnMoveLast(object sender, EventArgs e)
{
if ((_ribbonNumericUpDown != null) && (_ribbonNumericUpDown.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("KryptonRibbonGroupNumericUpDown MoveLast");
try
{
// Get access to the Items property
MemberDescriptor propertyItems = TypeDescriptor.GetProperties(_ribbonNumericUpDown.RibbonContainer)["Items"];
RaiseComponentChanging(propertyItems);
// Move position of the numeric up-down
items.Remove(_ribbonNumericUpDown);
items.Insert(items.Count, _ribbonNumericUpDown);
UpdateVerbStatus();
RaiseComponentChanged(propertyItems, null, null);
}
finally
{
// If we managed to create the transaction, then do it
if (transaction != null)
transaction.Commit();
}
}
}