Esempio n. 1
0
        /// <summary>
        /// Gets the design item property for the specified member descriptor.
        /// </summary>
        public static DesignItemProperty GetProperty(this DesignItemPropertyCollection properties, MemberDescriptor md)
        {
            DesignItemProperty prop = null;

            var pd = md as PropertyDescriptor;

            if (pd != null)
            {
                var dpd = DependencyPropertyDescriptor.FromProperty(pd);
                if (dpd != null)
                {
                    if (dpd.IsAttached)
                    {
                        prop = properties.GetAttachedProperty(dpd.DependencyProperty);
                    }
                    else
                    {
                        prop = properties.GetProperty(dpd.DependencyProperty);
                    }
                }
            }

            if (prop == null)
            {
                prop = properties[md.Name];
            }

            return(prop);
        }
Esempio n. 2
0
        /// <summary>
        /// Gets if the specified design item property represents an attached dependency property.
        /// </summary>
        public static bool IsAttachedDependencyProperty(this DesignItemProperty property)
        {
            if (property.DependencyProperty != null)
            {
                var dpd = DependencyPropertyDescriptor.FromProperty(property.DependencyProperty,
                                                                    property.DesignItem.ComponentType);
                return(dpd.IsAttached);
            }

            return(false);
        }
Esempio n. 3
0
 /// <summary>
 /// Gets whether the specified property was registered as popular.
 /// </summary>
 public static bool IsPopularProperty(DesignItemProperty p)
 {
     lock (popularProperties)
     {
         if (popularProperties.Contains(p.DependencyFullName))
         {
             return(true);
         }
     }
     return(false);
 }
Esempio n. 4
0
 /// <summary>
 /// Gets whether the specified property is browsable (should be visible in property grids).
 /// </summary>
 public static bool IsBrowsable(DesignItemProperty p)
 {
     lock (hiddenProperties)
     {
         if (hiddenProperties.Contains(p.DependencyFullName))
         {
             return(false);
         }
     }
     return(true);
 }
Esempio n. 5
0
        /// <summary>
        /// Gets the registered value range for the property, or null if no range was registered.
        /// </summary>
        public static NumberRange GetValueRange(DesignItemProperty p)
        {
            NumberRange r;

            lock (ranges)
            {
                if (ranges.TryGetValue(p.DependencyFullName, out r))
                {
                    return(r);
                }
            }
            return(null);
        }
Esempio n. 6
0
 /// <summary>
 /// Creates a new ComponentEventArgs instance.
 /// </summary>
 public DesignItemPropertyChangedEventArgs(DesignItem item, DesignItemProperty itemProperty) : base(item)
 {
     _itemProperty = itemProperty;
 }