Example #1
0
        private static void AddItemsTo(BindableCollection <Node> newParentCollection, IFlatListItem insertPlace, IEnumerable <Node> items)
        {
            var newItems = new List <Node>();
            var position = newParentCollection.IndexOf(insertPlace as Node);

            if (position != -1)
            {
                newItems.AddRange(newParentCollection.Take(position));
                newItems.AddRange(items);
                newItems.AddRange(newParentCollection.Skip(position));
            }
            else
            {
                newItems.AddRange(newParentCollection);
                newItems.AddRange(items);
            }
            newParentCollection.IsNotifying = false;
            newParentCollection.Clear();
            newParentCollection.AddRange(newItems);
            newParentCollection.IsNotifying = true;
            newParentCollection.Refresh();
        }