コード例 #1
0
        public void SetAnimationValue(DependencyProperty dependencyProperty, object value)
        {
            if (dependencyProperty == null)
            {
                throw new ArgumentNullException("No property specified");
            }

            INTERNAL_PropertyStorage storage;

            INTERNAL_PropertyStore.TryGetStorage(this, dependencyProperty, true /*create*/, out storage);
            INTERNAL_PropertyStore.SetAnimationValue(storage, value);
        }
コード例 #2
0
        public void CoerceValue(DependencyProperty dp)
        {
            if (dp == null)
            {
                throw new ArgumentNullException("No property specified.");
            }

            INTERNAL_PropertyStorage storage;

            INTERNAL_PropertyStore.TryGetStorage(this, dp, true /*create*/, out storage);
            INTERNAL_PropertyStore.CoerceValueCommon(storage);
        }
コード例 #3
0
        public void SetValue(DependencyProperty dp, object value)
        {
            // Verify the arguments:
            if (dp == null)
            {
                throw new ArgumentNullException("No property specified");
            }

            INTERNAL_PropertyStorage storage;

            INTERNAL_PropertyStore.TryGetStorage(this, dp, true /*create*/, out storage);
            INTERNAL_PropertyStore.SetValueCommon(storage, value, false);
        }
コード例 #4
0
        public object GetVisualStateValue(DependencyProperty dependencyProperty) //todo: see if this is actually useful (to get specifically the VisualStateValue) and if so, change the GetValue into a GetVisualStateValue at the "return" line.
        {
            if (dependencyProperty == null)
            {
                throw new ArgumentNullException("No property specified");
            }
            INTERNAL_PropertyStorage storage;

            if (INTERNAL_PropertyStore.TryGetStorage(this, dependencyProperty, false /*don't create*/, out storage))
            {
                return(storage.AnimatedValue);
            }
            return(dependencyProperty.GetTypeMetaData(this.GetType()).DefaultValue);
        }
コード例 #5
0
        public object GetAnimationValue(DependencyProperty dependencyProperty)
        {
            if (dependencyProperty == null)
            {
                throw new ArgumentNullException("No property specified");
            }

            INTERNAL_PropertyStorage storage;

            if (INTERNAL_PropertyStore.TryGetStorage(this, dependencyProperty, false /*don't create*/, out storage))
            {
                return(storage.AnimatedValue);
            }
            return(dependencyProperty.GetTypeMetaData(this.GetType()).DefaultValue);
        }
コード例 #6
0
        /// <summary>
        /// Returns the local value of a dependency property, if a local value is set.
        /// </summary>
        /// <param name="dependencyProperty">
        /// The DependencyProperty identifier of the property for which to retrieve the
        /// local value.
        /// </param>
        /// <returns>
        /// Returns the local value, or returns the sentinel value UnsetValue if no local
        /// value is set.
        /// </returns>
        public object ReadLocalValue(DependencyProperty dependencyProperty)
        {
            INTERNAL_PropertyStorage storage;

            if (INTERNAL_PropertyStore.TryGetStorage(this, dependencyProperty, false /*don't create*/, out storage))
            {
                if (storage.LocalValue == DependencyProperty.UnsetValue)
                {
                    // In silverlight ReadLocalValue returns a BindingExpression if the value
                    // is a BindingExpression set from a style's setter and the "real" local
                    // value in unset. (This is not the case in WPF)
                    if (storage.LocalStyleValue is BindingExpression be)
                    {
                        return(be);
                    }
                }
                return(storage.LocalValue);
            }
            return(DependencyProperty.UnsetValue);
        }