예제 #1
0
 /// <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);
     }
 }
예제 #2
0
        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;
            }
        }