public void OverrideMetadata(Type forType, PropertyMetadata typeMetadata, DependencyPropertyKey key)
        {
            if (forType == null)
            {
                throw new ArgumentNullException("forType");
            }
            if (typeMetadata == null)
            {
                throw new ArgumentNullException("typeMetadata");
            }
            if (key == null)
            {
                throw new ArgumentNullException("key");
            }

            // further checking?  should we check
            // key.DependencyProperty == this?

            typeMetadata.DoMerge(DefaultMetadata, this, forType);
            _metadataByType.TryAdd(forType, typeMetadata);
        }
        public void OverrideMetadata(Type forType, PropertyMetadata typeMetadata)
        {
            if (forType == null)
            {
                throw new ArgumentNullException("forType");
            }
            if (typeMetadata == null)
            {
                throw new ArgumentNullException("typeMetadata");
            }

            if (ReadOnly)
            {
                throw new InvalidOperationException(
                          String.Format(CultureInfo.InvariantCulture,
                                        Resources.CannotOverrideMetadataOnReadonlyPropertyWithoutUsingDependencyPropertyKey,
                                        Name));
            }

            typeMetadata.DoMerge(DefaultMetadata, this, forType);
            _metadataByType.TryAdd(forType, typeMetadata);
        }
示例#3
0
        public void OverrideMetadata(Type forType, PropertyMetadata typeMetadata, DependencyPropertyKey key)
        {
            if (forType == null)
                throw new ArgumentNullException("forType");
            if (typeMetadata == null)
                throw new ArgumentNullException("typeMetadata");
            if (key == null)
                throw new ArgumentNullException("key");

            // further checking?  should we check
            // key.DependencyProperty == this?

            typeMetadata.DoMerge(DefaultMetadata, this, forType);
            _metadataByType.TryAdd(forType, typeMetadata);
        }
示例#4
0
        public void OverrideMetadata(Type forType, PropertyMetadata typeMetadata)
        {
            if (forType == null)
                throw new ArgumentNullException("forType");
            if (typeMetadata == null)
                throw new ArgumentNullException("typeMetadata");

            if (ReadOnly)
                throw new InvalidOperationException(
                    String.Format(CultureInfo.InvariantCulture,
                                  Resources.CannotOverrideMetadataOnReadonlyPropertyWithoutUsingDependencyPropertyKey,
                                  Name));

            typeMetadata.DoMerge(DefaultMetadata, this, forType);
            _metadataByType.TryAdd(forType, typeMetadata);
        }