Esempio n. 1
0
        public void CoerceValue(DependencyProperty dp)
        {
            PropertyMetadata pm = dp.GetMetadata(this);

            if (pm.CoerceValueCallback != null)
            {
                pm.CoerceValueCallback(this, this.GetValue(dp));
            }
        }
Esempio n. 2
0
        private object GetDefaultValue(DependencyProperty dp)
        {
            PropertyMetadata          metadata          = dp.GetMetadata(this);
            FrameworkPropertyMetadata frameworkMetadata = metadata as FrameworkPropertyMetadata;
            object result = metadata.DefaultValue;

            if (frameworkMetadata != null && frameworkMetadata.Inherits)
            {
                if (this.dependencyParent != null)
                {
                    result = this.dependencyParent.GetValue(dp);
                }
            }

            return(result);
        }
Esempio n. 3
0
        private void SetValueInternal(DependencyProperty dp, object oldValue, object newValue)
        {
            PropertyMetadata metadata = dp.GetMetadata(this);

            if (metadata.CoerceValueCallback != null)
            {
                newValue = metadata.CoerceValueCallback(this, newValue);
            }

            if (newValue != DependencyProperty.UnsetValue && dp.IsValidValue(newValue))
            {
                this.properties[dp] = newValue;
            }
            else
            {
                this.properties.Remove(dp);
                newValue = this.GetValue(dp);
            }

            if (!this.AreEqual(oldValue, newValue))
            {
                this.OnPropertyChanged(new DependencyPropertyChangedEventArgs(dp, oldValue, newValue));
            }
        }
Esempio n. 4
0
        private void SetValueInternal(DependencyProperty dp, object oldValue, object newValue)
        {
            PropertyMetadata metadata = dp.GetMetadata(this);
            
            if (metadata.CoerceValueCallback != null)
            {
                newValue = metadata.CoerceValueCallback(this, newValue);
            }

            if (newValue != DependencyProperty.UnsetValue && dp.IsValidValue(newValue))
            {
                this.properties[dp] = newValue;
            }
            else
            {
                this.properties.Remove(dp);
                newValue = this.GetValue(dp);
            }

            if (!this.AreEqual(oldValue, newValue))
            {
                this.OnPropertyChanged(new DependencyPropertyChangedEventArgs(dp, oldValue, newValue));
            }
        }
Esempio n. 5
0
        private object GetDefaultValue(DependencyProperty dp)
        {
            PropertyMetadata metadata = dp.GetMetadata(this);
            FrameworkPropertyMetadata frameworkMetadata = metadata as FrameworkPropertyMetadata;
            object result = metadata.DefaultValue;

            if (frameworkMetadata != null && frameworkMetadata.Inherits)
            {
                if (this.dependencyParent != null)
                {
                    result = this.dependencyParent.GetValue(dp);
                }
            }

            return result;
        }
Esempio n. 6
0
 public void CoerceValue(DependencyProperty dp)
 {
     PropertyMetadata pm = dp.GetMetadata(this);
     if (pm.CoerceValueCallback != null)
     {
         pm.CoerceValueCallback(this, this.GetValue(dp));
     }
 }