Exemplo n.º 1
0
        public static DependencyProperty RegisterAttached(string name, Type propertyType, Type ownerType, PropertyMetadata defaultMetadata, ValidateValueCallback validateValueCallback)
        {
            ValidateRegisterParameters(name, propertyType, ownerType);
            var dp = new DependencyProperty(true, name, propertyType, ownerType, defaultMetadata, validateValueCallback);

            DependencyObject.Register(ownerType, dp);
            return(dp);
        }
Exemplo n.º 2
0
        public static DependencyProperty Register(string name, Type propertyType, Type ownerType, PropertyMetadata typeMetadata, ValidateValueCallback validateValueCallback)
        {
            ValidateRegisterParameters(name, propertyType, ownerType);
            var dp = new DependencyProperty(false, name, propertyType, ownerType, typeMetadata, validateValueCallback);

            DependencyObject.Register(ownerType, dp);

            // is this needed?
            //dp.OverrideMetadata(ownerType, typeMetadata);

            return(dp);
        }
Exemplo n.º 3
0
        public DependencyProperty AddOwner(Type ownerType, PropertyMetadata typeMetadata)
        {
            DependencyObject.Register(ownerType, this);

            if (typeMetadata == null)
            {
                typeMetadata = new PropertyMetadata();
            }

            OverrideMetadata(ownerType, typeMetadata);

            // MS seems to always return the same DependencyProperty
            return(this);
        }