private void OnComponentRemoving(object sender, ComponentEventArgs e) { // If our group is being removed if (e.Component == _ribbonGroup) { // Need access to host in order to delete a component IDesignerHost host = (IDesignerHost)GetService(typeof(IDesignerHost)); // We need to remove all containers from the group for (var j = _ribbonGroup.Items.Count - 1; j >= 0; j--) { KryptonRibbonGroupContainer item = _ribbonGroup.Items[j] as KryptonRibbonGroupContainer; _ribbonGroup.Items.Remove(item); host.DestroyComponent(item); } } }