예제 #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 SetPropertyValue(XamlPropertyValue value)
        {
            // Binding...
            //if (IsCollection) {
            //    throw new InvalidOperationException("Cannot set the value of collection properties.");
            //}

            bool wasSet = this.IsSet;

            PossiblyNameChanged(propertyValue, value);

            //reset expression
            var xamlObject = propertyValue as XamlObject;

            if (xamlObject != null && xamlObject.IsMarkupExtension)
            {
                propertyInfo.ResetValue(parentObject.Instance);
            }

            ResetInternal();

            propertyValue = value;
            if (propertyValue != null)
            {
                propertyValue.ParentProperty = this;
                propertyValue.AddNodeTo(this);
            }
            UpdateValueOnInstance();

            ParentObject.OnPropertyChanged(this);

            if (!wasSet)
            {
                if (IsSetChanged != null)
                {
                    IsSetChanged(this, EventArgs.Empty);
                }
            }

            if (ValueChanged != null)
            {
                ValueChanged(this, EventArgs.Empty);
            }
        }
예제 #3
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);
			}
		}
예제 #4
0
		void SetPropertyValue(XamlPropertyValue value)
		{
			// Binding...
			//if (IsCollection) {
			//    throw new InvalidOperationException("Cannot set the value of collection properties.");
			//}
			
			bool wasSet = this.IsSet;
			
			PossiblyNameChanged(propertyValue, value);

			//reset expression
			var xamlObject = propertyValue as XamlObject;
			if (xamlObject != null && xamlObject.IsMarkupExtension)
				propertyInfo.ResetValue(parentObject.Instance);
			
			ResetInternal();

			propertyValue = value;
			propertyValue.ParentProperty = this;
			propertyValue.AddNodeTo(this);
			UpdateValueOnInstance();
			
			ParentObject.OnPropertyChanged(this);
			
			if (!wasSet) {
				if (IsSetChanged != null) {
					IsSetChanged(this, EventArgs.Empty);
				}
			}

			if (ValueChanged != null) {
				ValueChanged(this, EventArgs.Empty);
			}
		}