public static DependencyProperty Register( string name, Type propertyType, Type ownerType, PropertyMetadata typeMetadata, ValidateValueCallback validateValueCallback) { PropertyMetadata defaultMetadata; if (typeMetadata == null) { defaultMetadata = typeMetadata = new PropertyMetadata(); } else { defaultMetadata = new PropertyMetadata(typeMetadata.DefaultValue); } DependencyProperty dp = new DependencyProperty( false, name, propertyType, ownerType, defaultMetadata, validateValueCallback); DependencyObject.Register(ownerType, dp); dp.OverrideMetadata(ownerType, typeMetadata); return(dp); }
public DependencyProperty AddOwner(Type ownerType, PropertyMetadata typeMetadata) { if (typeMetadata == null) { typeMetadata = new PropertyMetadata(); } this.OverrideMetadata(ownerType, typeMetadata); DependencyObject.Register(ownerType, this); // MS seems to always return the same DependencyProperty return(this); }
public static DependencyProperty RegisterAttached( string name, Type propertyType, Type ownerType, PropertyMetadata defaultMetadata, ValidateValueCallback validateValueCallback) { if (defaultMetadata == null) { defaultMetadata = new PropertyMetadata(); } DependencyProperty dp = new DependencyProperty( true, name, propertyType, ownerType, defaultMetadata, validateValueCallback); DependencyObject.Register(ownerType, dp); return(dp); }