ComponentFactory.Krypton.Ribbon.KryptonRibbonGroupRadioButtonDesigner.OnMoveFirst C# (CSharp) Method

OnMoveFirst() private method

private OnMoveFirst ( object sender, EventArgs e ) : void
sender object
e System.EventArgs
return void
        private void OnMoveFirst(object sender, EventArgs e)
        {
            if ((_ribbonRadioButton != null) && (_ribbonRadioButton.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("KryptonRibbonGroupRadioButton MoveFirst");

                try
                {
                    // Get access to the Items property
                    MemberDescriptor propertyItems = TypeDescriptor.GetProperties(_ribbonRadioButton.RibbonContainer)["Items"];

                    RaiseComponentChanging(propertyItems);

                    // Move position of the radio button
                    items.Remove(_ribbonRadioButton);
                    items.Insert(0, _ribbonRadioButton);
                    UpdateVerbStatus();

                    RaiseComponentChanged(propertyItems, null, null);
                }
                finally
                {
                    // If we managed to create the transaction, then do it
                    if (transaction != null)
                        transaction.Commit();
                }
            }
        }