示例#1
0
 /// <summary>
 /// Initializes a new instance of the <see cref="DependencyProperty"/> class.
 /// </summary>
 /// <param name="declaringType">The type which declares the property.</param>
 /// <param name="ownerType">The type which can own this property.</param>
 /// <param name="propertyType">The type of the property.</param>
 /// <param name="name">The name of the property.</param>
 /// <param name="defaultBindingMode">The default <see cref="BindingMode"/> for this property.</param>
 /// <param name="isAttachement">Specifies if the property is a attachement.</param>
 /// <param name="createValueCallback">The default value of the property.</param>
 /// <param name="coerceValueCallback">The callback for coercing the value.</param>
 /// <param name="validationCallback">The validation callback of the value.</param>
 /// <param name="changingCallback">The changing callback of the property.</param>
 /// <param name="changedCallback">The changed callback of the property.</param>
 internal DependencyProperty(TypeInfo declaringType, String name, BindingMode defaultBindingMode, Boolean isAttachement, CreateValueDelegate <TOwner, TProperty> createValueCallback, CoerceValueDelegate <TOwner, TProperty> coerceValueCallback, PropertyValidationDelegate <TOwner, TProperty> validationCallback, PropertyChangingDelegate <TOwner, TProperty> changingCallback, PropertyChangedDelegate <TOwner, TProperty> changedCallback)
     : base(declaringType, Reflection.TypeOf <TOwner> .TypeInfo, name, defaultBindingMode, isAttachement, false)
 {
     _CreateValueCallback = createValueCallback;
     _CoerceValueCallback = coerceValueCallback;
     _ValidationCallback  = validationCallback;
     _ChangingCallback    = changingCallback;
     _ChangedCallback     = changedCallback;
 }
示例#2
0
 /// <summary>
 /// Initializes a new instance of the <see cref="DependencyProperty"/> class.
 /// </summary>
 /// <param name="declaringType">The type which declares the property.</param>
 /// <param name="ownerType">The type which can own this property.</param>
 /// <param name="propertyType">The type of the property.</param>
 /// <param name="name">The name of the property.</param>
 /// <param name="defaultBindingMode">The default <see cref="BindingMode"/> for this property.</param>
 /// <param name="isAttachement">Specifies if the property is a attachement.</param>
 /// <param name="defaultValue">The default value of the property.</param>
 /// <param name="coerceValueCallback">The callback for coercing the value.</param>
 /// <param name="validationCallback">The validation callback of the value.</param>
 /// <param name="changingCallback">The changing callback of the property.</param>
 /// <param name="changedCallback">The changed callback of the property.</param>
 internal DependencyProperty(TypeInfo declaringType, String name, BindingMode defaultBindingMode, Boolean isAttachement, TProperty defaultValue, CoerceValueDelegate <TOwner, TProperty> coerceValueCallback, PropertyValidationDelegate <TOwner, TProperty> validationCallback, PropertyChangingDelegate <TOwner, TProperty> changingCallback, PropertyChangedDelegate <TOwner, TProperty> changedCallback, out DependencyPropertyKey <TProperty> key)
     : base(declaringType, Reflection.TypeOf <TOwner> .TypeInfo, name, defaultBindingMode, isAttachement, false)
 {
     _DefaultValue        = defaultValue;
     _CoerceValueCallback = coerceValueCallback;
     _ValidationCallback  = validationCallback;
     _ChangingCallback    = changingCallback;
     _ChangedCallback     = changedCallback;
     Key = key = new DependencyPropertyKey <TProperty>(this);
 }
 public static DependencyPropertyKey <TProperty> CreateReadonlyAttachment <TDeclarer, TOwner, TProperty>(String name, CreateValueDelegate <TOwner, TProperty> defaultValueFactory, BindingMode bindingMode = BindingMode.Default, PropertyValidationDelegate <TOwner, TProperty> validation = null, PropertyChangingDelegate <TOwner, TProperty> propertyChanging = null, PropertyChangedDelegate <TOwner, TProperty> propertyChanged = null, CoerceValueDelegate <TOwner, TProperty> coerceValue = null)
     where TOwner : class, IDependencyObject
 {
     ValidatePropertyName(name);
     new DependencyProperty <TProperty, TOwner>(TypeOf <TDeclarer> .TypeInfo, name, bindingMode, true, defaultValueFactory, coerceValue, validation, propertyChanging, propertyChanged, out DependencyPropertyKey <TProperty> key);
     return(key);
 }
 public static DependencyPropertyKey <TProperty> CreateReadonly <TDeclarer, TProperty>(Expression <Func <TDeclarer, TProperty> > getter, CreateValueDelegate <TDeclarer, TProperty> defaultValueFactory, BindingMode bindingMode = BindingMode.Default, PropertyValidationDelegate <TDeclarer, TProperty> validation = null, PropertyChangingDelegate <TDeclarer, TProperty> propertyChanging = null, PropertyChangedDelegate <TDeclarer, TProperty> propertyChanged = null, CoerceValueDelegate <TDeclarer, TProperty> coerceValue = null)
     where TDeclarer : class, IDependencyObject
 {
     new DependencyProperty <TProperty, TDeclarer>(TypeOf <TDeclarer> .TypeInfo, GetPropertyName <TDeclarer, TProperty>(getter), bindingMode, true, defaultValueFactory, coerceValue, validation, propertyChanging, propertyChanged, out DependencyPropertyKey <TProperty> key);
     return(key);
 }
 public static DependencyProperty <TProperty> Create <TDeclarer, TProperty>(Expression <Func <TDeclarer, TProperty> > getter, TProperty defaultValue = default(TProperty), BindingMode bindingMode = BindingMode.Default, PropertyValidationDelegate <TDeclarer, TProperty> validation = null, PropertyChangingDelegate <TDeclarer, TProperty> propertyChanging = null, PropertyChangedDelegate <TDeclarer, TProperty> propertyChanged = null, CoerceValueDelegate <TDeclarer, TProperty> coerceValue = null)
     where TDeclarer : class, IDependencyObject
 {
     return(new DependencyProperty <TProperty, TDeclarer>(TypeOf <TDeclarer> .TypeInfo, GetPropertyName <TDeclarer, TProperty>(getter), bindingMode, false, defaultValue, coerceValue, validation, propertyChanging, propertyChanged));
 }