示例#1
0
        protected virtual void ApplyCollectionItemAdd(ApplyingCollectionChangeBundle bundle)
        {
            var itemContentChange      = bundle.ItemContentChange;
            var newContentContentItems = itemContentChange.NewItems;

            if (newContentContentItems is null)
            {
                throw new ArgumentException("No new item-content-items were given although an add collection change action has been triggered.");
            }

            var newItemsCount = newContentContentItems.Count;

            for (int itemIndex = 0; itemIndex < newItemsCount; itemIndex++)
            {
                var content         = newContentContentItems[itemIndex];
                var itemInsertIndex = itemContentChange.NewIndex + itemIndex;
                var item            = CreateItem(content);

                ItemList.Insert(itemInsertIndex, item);
                ContentList.Insert(itemInsertIndex, content);
            }
        }