示例#1
0
        PropertyDescriptorCollection ICustomTypeDescriptor.GetProperties()
        {
            // get model properties
            List <PropertyDescriptor> properties = new List <PropertyDescriptor>();


            foreach (PropertyDescriptor modelPropertyDescriptor in ModelUtilities.WrapProperties(this))
            {
                properties.Add(modelPropertyDescriptor);
            }

            // try to see if there are pseudo builtin properties for this type.
            AttachedPropertiesService AttachedPropertiesService = this.modelTreeManager.Context.Services.GetService <AttachedPropertiesService>();

            if (AttachedPropertiesService != null)
            {
                var nonBrowsableAttachedProperties = from attachedProperty in AttachedPropertiesService.GetAttachedProperties(this.itemType)
                                                     where (!attachedProperty.IsBrowsable && !attachedProperty.IsVisibleToModelItem)
                                                     select attachedProperty;

                foreach (AttachedProperty AttachedProperty in nonBrowsableAttachedProperties)
                {
                    properties.Add(new AttachedPropertyDescriptor(AttachedProperty, this));
                }
            }
            return(new PropertyDescriptorCollection(properties.ToArray(), true));
        }
示例#2
0
 PropertyDescriptorCollection ICustomTypeDescriptor.GetProperties(Attribute[] attributes)
 {
     return(ModelUtilities.WrapProperties(this));
 }