Esempio n. 1
0
        protected override void InsertItem(int index, XamlPropertyValue item)
        {
            XamlPropertyInfo info       = property.propertyInfo;
            object           collection = info.GetValue(property.ParentObject.Instance);

            CollectionSupport.Insert(info.ReturnType, collection, item, index);

            item.ParentProperty = property;
            property.InsertNodeInCollection(item.GetNodeForCollection(), index);

            base.InsertItem(index, item);
        }
        protected override void InsertItem(int index, XamlPropertyValue item)
        {
            XamlPropertyInfo info       = property.propertyInfo;
            object           collection = info.GetValue(property.ParentObject.Instance);

            if (!CollectionSupport.TryInsert(info.ReturnType, collection, item, index))
            {
                CollectionSupport.AddToCollection(info.ReturnType, collection, item);
            }

            item.ParentProperty = property;
            property.InsertNodeInCollection(item.GetNodeForCollection(), index);

            base.InsertItem(index, item);

            if (CollectionChanged != null)
            {
                CollectionChanged(this, new NotifyCollectionChangedEventArgs(NotifyCollectionChangedAction.Add, item, index));
            }
        }