/// <summary> /// used internally by the XamlParser. /// Add a collection element that already is part of the XML DOM. /// </summary> internal void ParserAddCollectionElement(XmlElement collectionPropertyElement, XamlPropertyValue val) { if (collectionPropertyElement != null && _propertyElement == null) { ParserSetPropertyElement(collectionPropertyElement); } collectionElements.AddInternal(val); val.ParentProperty = this; if (collectionPropertyElement != _propertyElement) { val.RemoveNodeFromParent(); val.AddNodeTo(this); } }
void ResetInternal() { bool isExplicitCollection = false; if (propertyValue != null) { isExplicitCollection = IsCollection; propertyValue.RemoveNodeFromParent(); propertyValue.ParentProperty = null; propertyValue = null; } if (_propertyElement != null) { Debug.Assert(!isExplicitCollection || _propertyElement.ParentNode == null); if (!isExplicitCollection) { _propertyElement.ParentNode.RemoveChild(_propertyElement); } _propertyElement = null; } }