/// <devdoc> /// Retrieves an array of properties that the given component instance /// provides. This may differ from the set of properties the class /// provides. If the component is sited, the site may add or remove /// additional properties. The returned array of properties will be /// filtered by the given set of attributes. /// </devdoc> PropertyDescriptorCollection ICustomTypeDescriptor.GetProperties(Attribute[] attributes) { PropertyDescriptorCollection baseProps = TypeDescriptor.GetProperties(baseObject, attributes); if (filteredProps.Keys.Count > 0) { ArrayList propList = new ArrayList(); foreach (PropertyDescriptor prop in baseProps) { Attribute attr = (Attribute)filteredProps[prop]; if (attr != null) { //BEGIN INTENTIONAL CHANGES from VSIP version of AutomationExtenderManager.cs PropertyDescriptor filteredProp; if (attr is System.ComponentModel.ReadOnlyAttribute) { // If we're filtering this property to be read-only, we want to simply wrap it // with a class that makes the property appear read-only. We don't use // TypeDescriptor.CreateProperty() because it doesn't work well with // Com2PropertyDescriptor (gives an exception trying to get the value). // We can't change this behavior for properties we're "hiding" // without changing current behavior in the project designer. filteredProp = new ReadOnlyPropertyDescriptorWrapper(prop); } else { filteredProp = TypeDescriptor.CreateProperty(baseObject.GetType(), prop, attr); } //END INTENTIONAL CHANGES if (filteredProp.Attributes.Contains(attributes)) { propList.Add(filteredProp); } } else { propList.Add(prop); } } PropertyDescriptor[] propArray = new PropertyDescriptor[propList.Count]; propList.CopyTo(propArray, 0); baseProps = new PropertyDescriptorCollection(propArray); } return(baseProps); }
/// <devdoc> /// Retrieves an array of properties that the given component instance /// provides. This may differ from the set of properties the class /// provides. If the component is sited, the site may add or remove /// additional properties. The returned array of properties will be /// filtered by the given set of attributes. /// </devdoc> PropertyDescriptorCollection ICustomTypeDescriptor.GetProperties(Attribute[] attributes) { PropertyDescriptorCollection baseProps = TypeDescriptor.GetProperties(baseObject, attributes); if (filteredProps.Keys.Count > 0) { ArrayList propList = new ArrayList(); foreach (PropertyDescriptor prop in baseProps) { Attribute attr = (Attribute)filteredProps[prop]; if (attr != null) { //BEGIN INTENTIONAL CHANGES from VSIP version of AutomationExtenderManager.cs PropertyDescriptor filteredProp; if (attr is System.ComponentModel.ReadOnlyAttribute) { // If we're filtering this property to be read-only, we want to simply wrap it // with a class that makes the property appear read-only. We don't use // TypeDescriptor.CreateProperty() because it doesn't work well with // Com2PropertyDescriptor (gives an exception trying to get the value). // We can't change this behavior for properties we're "hiding" // without changing current behavior in the project designer. filteredProp = new ReadOnlyPropertyDescriptorWrapper(prop); } else { filteredProp = TypeDescriptor.CreateProperty(baseObject.GetType(), prop, attr); } //END INTENTIONAL CHANGES if (filteredProp.Attributes.Contains(attributes)) { propList.Add(filteredProp); } } else { propList.Add(prop); } } PropertyDescriptor[] propArray = new PropertyDescriptor[propList.Count]; propList.CopyTo(propArray, 0); baseProps = new PropertyDescriptorCollection(propArray); } return baseProps; }