コード例 #1
0
        /// <summary>
        /// Constructor
        /// </summary>
        /// <param name="defaultValue">The default value of the Dependency Property</param>
        internal DependencyPropertyDetails(DependencyProperty property, Type dependencyObjectType) : this()
        {
            Property        = property;
            _hasWeakStorage = property.HasWeakStorage;

            Array.Copy(_unsetStack, _stack, _stackLength);

            var defaultValue = Property.GetMetadata(dependencyObjectType).DefaultValue;

            // Ensures that the default value of non-nullable properties is not null
            if (defaultValue == null && !Property.IsTypeNullable)
            {
                defaultValue = Property.GetFallbackDefaultValue();
            }

            _stack[MaxIndex] = defaultValue;

            Metadata = property.GetMetadata(dependencyObjectType);
        }
コード例 #2
0
        /// <summary>
        /// Constructor
        /// </summary>
        /// <param name="defaultValue">The default value of the Dependency Property</param>
        internal DependencyPropertyDetails(DependencyProperty property, Type dependencyObjectType) : this()
        {
            Property        = property;
            _hasWeakStorage = property.HasWeakStorage;

            for (int i = 0; i < MaxIndex; i++)
            {
                _stack[i] = DependencyProperty.UnsetValue;
            }

            var defaultValue = Property.GetMetadata(dependencyObjectType).DefaultValue;

            // Ensures that the default value of non-nullable properties is not null
            if (defaultValue == null && !Property.IsTypeNullable)
            {
                defaultValue = Property.GetFallbackDefaultValue();
            }

            _stack[MaxIndex] = defaultValue;

            Metadata = property.GetMetadata(dependencyObjectType);
        }