Exemplo n.º 1
0
        /// <summary>
        /// Registers an attached Proeprty on the specific class.
        /// </summary>
        /// <typeparam name="TValue">The type of the Property</typeparam>
        /// <typeparam name="TType">The Type of the Object that defines the Property</typeparam>
        /// <param name="changingMethod">The Method that will be called if the property will be set.</param>
        /// <param name="defaultValue">The default Value that the Proeprty will have if no value is set.</param>
        /// <param name="nullTreatment">Defines how to handle Null values.</param>
        /// <param name="settigns">Additional Settings.</param>
        /// <returns>The Property key</returns>
        public static NDAttachedPropertyKey <TKey, TType, TValue> RegisterAttached <TType, TValue>(OnChanging <TKey, TType, TValue> changingMethod, TValue defaultValue, NDPropertySettings settigns)
            where TType : class
        {
            var p = new NDAttachedPropertyKey <TKey, TType, TValue>(changingMethod, defaultValue, settigns);

            if (p.Inherited)
            {
                if (!inheritedPropertys.ContainsKey(typeof(TType)))
                {
                    inheritedPropertys.Add(typeof(TType), new List <IInternalNDProperty <TKey> >());
                }
                inheritedPropertys[typeof(TType)].Add(p);
            }
            if (settigns.HasFlag(NDPropertySettings.ParentReference))
            {
                AddParentHandler(p);
            }

            return(p);
        }
Exemplo n.º 2
0
 public static AttachedHelper <TKey, TType, TValue> Create <TKey, TType, TValue>(NDAttachedPropertyKey <TKey, TType, TValue> property) where TType : class => new AttachedHelper <TKey, TType, TValue>(property);
Exemplo n.º 3
0
 public Delegater(NDAttachedPropertyKey <TKey, TType, TValue> property, TType index)
 {
     this.property = property;
     this.index    = index;
 }