/// <summary> /// Function to unmerge items for a group from an existing items list in the target ribbon group. /// </summary> /// <param name="sourceItems">The source items to unmerge.</param> /// <param name="targetItems">The destination items to unmerge.</param> private void UnmergeGroupItems(KryptonRibbonGroupContainerCollection sourceItems, KryptonRibbonGroupContainerCollection targetItems) { IEnumerable <KryptonRibbonGroupContainer> items = targetItems.ToArray(); foreach (KryptonRibbonGroupContainer item in items) { if (!_mergedItems.Contains(item)) { continue; } _mergedItems.Remove(item); targetItems.Remove(item); sourceItems.Add(item); } }
/// <summary> /// Function to merge items from a group into an existing items list in the target ribbon group. /// </summary> /// <param name="sourceItems">The source items to merge.</param> /// <param name="targetItems">The destination items to merge.</param> private void MergeGroupItems(KryptonRibbonGroupContainerCollection sourceItems, KryptonRibbonGroupContainerCollection targetItems) { IEnumerable <KryptonRibbonGroupContainer> items = sourceItems.ToArray(); foreach (KryptonRibbonGroupContainer sourceItem in items) { if (targetItems.Contains(sourceItem)) { continue; } sourceItems.Remove(sourceItem); int index = GetSortIndexFromTag(sourceItem.Tag, targetItems.Count); targetItems.Insert(index, sourceItem); if (!_mergedItems.Contains(sourceItem)) { _mergedItems.Add(sourceItem); } } }