/// <summary> /// Raises the Removing event. /// </summary> /// <param name="e">A TypedCollectionEventArgs instance containing event data.</param> protected override void OnRemoving(TypedCollectionEventArgs <KryptonContextMenuItemBase> e) { // Must unhook from the change event to prevent memory leak KryptonContextMenuRadioButton radioButton = e.Item as KryptonContextMenuRadioButton; if (radioButton != null) { radioButton.CheckedChanged -= new EventHandler(OnRadioButtonCheckedChanged); } base.OnRemoving(e); }
/// <summary> /// Raises the Inserted event. /// </summary> /// <param name="e">A TypedCollectionEventArgs instance containing event data.</param> protected override void OnInserted(TypedCollectionEventArgs <KryptonContextMenuItemBase> e) { base.OnInserted(e); // We monitor changes to the checked state of radio buttons KryptonContextMenuRadioButton radioButton = e.Item as KryptonContextMenuRadioButton; if (radioButton != null) { radioButton.CheckedChanged += new EventHandler(OnRadioButtonCheckedChanged); } }