Exemple #1
0
        private int FindBoundObjectIndex(RadObject boundObject)
        {
            if (this.boundObjects == null)
            {
                return(-1);
            }

            int count = this.boundObjects.Count;

            for (int i = count - 1; i >= 0; i--)
            {
                PropertyBoundObject relation = this.boundObjects[i];
                RadObject           obj      = relation.Object;
                if (obj == null)
                {
                    this.boundObjects.RemoveAt(i);
                }
                else if (obj == boundObject)
                {
                    return(i);
                }
            }

            return(-1);
        }
Exemple #2
0
        /// <summary>
        /// Resets all references - such as binding references and property modifiers.
        /// </summary>
        internal void Dispose()
        {
            this.lockComposeCount++;
            this.lockValueUpdateCount++;
            //remove binding references
            this.owner.RemoveBinding(this);

            if (this.boundObjects != null)
            {
                int count = this.boundObjects.Count;
                for (int i = count - 1; i >= 0; i--)
                {
                    PropertyBoundObject reference   = this.boundObjects[i];
                    RadObject           boundObject = reference.Object;
                    if (boundObject != null &&
                        !(boundObject.IsDisposed || boundObject.IsDisposing))
                    {
                        boundObject.UnbindProperty(reference.Property);
                    }
                }
                this.boundObjects.Clear();
            }

            //reset references
            this.property         = null;
            this.metadata         = null;
            this.owner            = null;
            this.propertyBinding  = null;
            this.animationSetting = null;
            this.styleSetting     = null;
        }
Exemple #3
0
        /// <summary>
        /// Notifies all bound objects for a change in this property.
        /// </summary>
        internal void NotifyBoundObjects()
        {
            //no bound objects registered
            if (this.boundObjects == null)
            {
                return;
            }

            //update all bound objects that our value has changed
            int count = this.boundObjects.Count;

            for (int i = count - 1; i >= 0; i--)
            {
                PropertyBoundObject relation = this.boundObjects[i];
                RadObject           obj      = relation.Object;
                if (obj != null)
                {
                    obj.OnBoundSourcePropertyChanged(relation.Property);
                }
                else
                {
                    this.boundObjects.RemoveAt(i);
                }
            }
        }
Exemple #4
0
 internal void Dispose()
 {
     ++this.lockComposeCount;
     ++this.lockValueUpdateCount;
     if (this.owner != null)
     {
         this.owner.RemoveBinding(this);
     }
     if (this.boundObjects != null)
     {
         for (int index = this.boundObjects.Count - 1; index >= 0; --index)
         {
             PropertyBoundObject boundObject = this.boundObjects[index];
             RadObject           radObject   = boundObject.Object;
             if (radObject != null && !radObject.IsDisposed && !radObject.IsDisposing)
             {
                 int num = (int)radObject.UnbindProperty(boundObject.Property);
             }
         }
         this.boundObjects.Clear();
     }
     this.property         = (RadProperty)null;
     this.metadata         = (RadPropertyMetadata)null;
     this.owner            = (RadObject)null;
     this.propertyBinding  = (PropertyBinding)null;
     this.animationSetting = (AnimatedPropertySetting)null;
     this.styleSetting     = (IPropertySetting)null;
 }
Exemple #5
0
 internal void AddBoundObject(PropertyBoundObject relation)
 {
     if (this.boundObjects == null)
     {
         this.boundObjects = new List <PropertyBoundObject>();
     }
     if (this.FindBoundObjectIndex(relation.Object) >= 0)
     {
         return;
     }
     this.boundObjects.Add(relation);
 }
Exemple #6
0
        /// <summary>
        /// Registers an object which is bound to this property value.
        /// </summary>
        /// <param name="relation"></param>
        internal void AddBoundObject(PropertyBoundObject relation)
        {
            if (boundObjects == null)
            {
                boundObjects = new List <PropertyBoundObject>();
            }

            int index = this.FindBoundObjectIndex(relation.Object);

            if (index != -1)
            {
                return;
            }

            //register relation
            boundObjects.Add(relation);
        }
Exemple #7
0
 internal void NotifyBoundObjects()
 {
     if (this.boundObjects == null)
     {
         return;
     }
     for (int index = this.boundObjects.Count - 1; index >= 0; --index)
     {
         PropertyBoundObject boundObject = this.boundObjects[index];
         RadObject           radObject   = boundObject.Object;
         if (radObject != null)
         {
             radObject.OnBoundSourcePropertyChanged(boundObject.Property);
         }
         else
         {
             this.boundObjects.RemoveAt(index);
         }
     }
 }