Example #1
0
        protected override void RemoveItem(int index)
        {
            XamlPropertyInfo info       = property.propertyInfo;
            object           collection = info.GetValue(property.ParentObject.Instance);

            if (!CollectionSupport.RemoveItemAt(info.ReturnType, collection, index))
            {
                CollectionSupport.RemoveItem(info.ReturnType, collection, this[index].GetValueFor(info));
            }

            this[index].RemoveNodeFromParent();
            this[index].ParentProperty = null;
            base.RemoveItem(index);
        }
        protected override void RemoveItem(int index)
        {
            XamlPropertyInfo info       = property.propertyInfo;
            object           collection = info.GetValue(property.ParentObject.Instance);

            if (!CollectionSupport.RemoveItemAt(info.ReturnType, collection, index))
            {
                var propertyValue = this[index];
                CollectionSupport.RemoveItem(info.ReturnType, collection, propertyValue.GetValueFor(info), propertyValue);
            }

            var item = this[index];

            item.RemoveNodeFromParent();
            item.ParentProperty = null;
            base.RemoveItem(index);

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