Beispiel #1
0
        /// <summary>
        /// Registers a readonly attached property with the dependency property system.
        /// </summary>
        /// <typeparam name="TProperty">The type of the attached property (inferred)</typeparam>
        /// <param name="getter">The attached property's getter (verified for required verbiage and type).</param>
        /// <param name="setter">The attached property's setter (verified for required verbiage and type).</param>
        /// <param name="metadata">The property metadata to register for this attached property with the dependency property system.</param>
        /// <returns>The <see cref="DependencyProperty"/> that was registered for this attached property.</returns>
        public DependencyPropertyKey RegisterReadOnly <TProperty>(StaticAPUtils.GetterFunc <TProperty> getter, StaticAPUtils.SetterFunc <TProperty> setter, PropertyMetadata metadata)
        {
            StaticAPUtils.ValidateAccessors(getter, setter);

            // Could use getter or setter, it's the same either way
            string name = getter.Method.Name.Substring(3);

            return(DependencyProperty.RegisterAttachedReadOnly(name, typeof(TProperty), m_targetType, metadata));
        }
Beispiel #2
0
 /// <summary>
 /// Registers an attached property with the dependency property system.
 /// </summary>
 /// <typeparam name="TProperty">The type of the attached property (inferred)</typeparam>
 /// <param name="getter">The attached property's getter (verified for required verbiage and type).</param>
 /// <param name="setter">The attached property's setter (verified for required verbiage and type).</param>
 /// <param name="defaultValue">The default value for the attached property.</param>
 /// <param name="propChanged">The property changed callback delegate.</param>
 /// <returns>The <see cref="DependencyProperty"/> that was registered for this attached property.</returns>
 public DependencyProperty Register <TProperty>(StaticAPUtils.GetterFunc <TProperty> getter, StaticAPUtils.SetterFunc <TProperty> setter, TProperty defaultValue, CastedPropertyChangedCallback <TProperty> propChanged)
 {
     return(Register(getter, setter, new PropertyMetadata(defaultValue, DownCast(propChanged))));
 }
Beispiel #3
0
 /// <summary>
 /// Registers an attached property with the dependency property system.
 /// </summary>
 /// <typeparam name="TProperty">The type of the attached property (inferred)</typeparam>
 /// <param name="getter">The attached property's getter (verified for required verbiage and type).</param>
 /// <param name="setter">The attached property's setter (verified for required verbiage and type).</param>
 /// <param name="defaultValue">The default value for the attached property.</param>
 /// <returns>The <see cref="DependencyProperty"/> that was registered for this attached property.</returns>
 public DependencyProperty Register <TProperty>(StaticAPUtils.GetterFunc <TProperty> getter, StaticAPUtils.SetterFunc <TProperty> setter, TProperty defaultValue)
 {
     return(Register(getter, setter, new PropertyMetadata(defaultValue)));
 }
Beispiel #4
0
 /// <summary>
 /// Registers a readonly attached property with the dependency property system.
 /// Note the default value for this attached property will be default(<see cref="TProperty"/>)
 /// </summary>
 /// <typeparam name="TProperty">The type of the attached property (inferred)</typeparam>
 /// <param name="getter">The attached property's getter (verified for required verbiage and type).</param>
 /// <param name="setter">The attached property's setter (verified for required verbiage and type).</param>
 /// <param name="propChanged">The property changed callback delegate.</param>
 /// <returns>The <see cref="DependencyProperty"/> that was registered for this attached property.</returns>
 public DependencyPropertyKey RegisterReadOnly <TProperty>(StaticAPUtils.GetterFunc <TProperty> getter, StaticAPUtils.SetterFunc <TProperty> setter, CastedPropertyChangedCallback <TProperty> propChanged)
 {
     return(RegisterReadOnly(getter, setter, new FrameworkPropertyMetadata(default(TProperty), DownCast(propChanged))));
 }
Beispiel #5
0
 /// <summary>
 /// Registers a readonly attached property with the dependency property system.
 /// </summary>
 /// <typeparam name="TProperty">The type of the attached property (inferred)</typeparam>
 /// <param name="getter">The attached property's getter (verified for required verbiage and type).</param>
 /// <param name="setter">The attached property's setter (verified for required verbiage and type).</param>
 /// <param name="defaultValue">The default value for the attached property.</param>
 /// <returns>The <see cref="DependencyProperty"/> that was registered for this attached property.</returns>
 public DependencyPropertyKey RegisterReadOnly <TProperty>(StaticAPUtils.GetterFunc <TProperty> getter, StaticAPUtils.SetterFunc <TProperty> setter, TProperty defaultValue)
 {
     return(RegisterReadOnly(getter, setter, new FrameworkPropertyMetadata(defaultValue)));
 }