public override PropertyDescriptorCollection GetProperties(ITypeDescriptorContext context, object value, Attribute[] attributes) { PropertyDescriptorCollection descriptors = new PropertyDescriptorCollection(null); descriptors.Add(new RuleConditionReferenceNamePropertyDescriptor(context, TypeDescriptor.CreateProperty(typeof(RuleConditionReference), "ConditionName", typeof(string), new Attribute[] { new DesignerSerializationVisibilityAttribute(DesignerSerializationVisibility.Content), DesignOnlyAttribute.Yes }))); descriptors.Add(new RuleConditionReferencePropertyDescriptor(context, TypeDescriptor.CreateProperty(typeof(RuleConditionReference), "Expression", typeof(CodeExpression), new Attribute[] { new DesignerSerializationVisibilityAttribute(DesignerSerializationVisibility.Content), DesignOnlyAttribute.Yes }))); return descriptors.Sort(new string[] { "ConditionName", "Expression" }); }
public FFTypeDescriptor([NotNull]object targetObject) { _WrappedObject = targetObject; Type type = targetObject.GetType(); PropertyDescriptorCollection pdc; if (!__TypedDescriptorCollection.TryGetValue(type, out pdc)) { pdc = new PropertyDescriptorCollection(null); foreach (PropertyDescriptor pd in TypeDescriptor.GetProperties(type)) { var desc = new MyPropDesc(pd); desc.ValueChanging += Property_ValueChanging; pdc.Add(desc); } foreach (BindPropertyAttribute a in type.GetCustomAttributes<BindPropertyAttribute>()) { var childProp = a.GetSourcePropertyInfo(type); var v = childProp.GetValue(targetObject, null); var pdcs = TypeDescriptor.GetProperties(v, false); var bpd = new BindPropertyDescriptor(pdcs[a.Property], childProp, a.DisplayName, a.Description, a.Category); bpd.ValueChanging += Property_ValueChanging; pdc.Add(bpd); } __TypedDescriptorCollection.Add(type, pdc); } _DescriptorCollection = pdc; }
public PropertyDescriptorCollection GetProperties(Attribute[] attributes) { var originalProperties = TypeDescriptor.GetProperties(this, true); var originalArray = new PropertyDescriptor[originalProperties.Count]; originalProperties.CopyTo(originalArray, 0); var result = new PropertyDescriptorCollection(originalArray, false); foreach (PropertyDescriptor descriptor in originalProperties) { if (descriptor.Name == TestPropertyPropertyName) { var newDescriptor = new TestPropertyDescriptor( descriptor.Name + PropertyNameSuffix, typeof(string), descriptor); result.Add(newDescriptor); } else { result.Add(descriptor); } } return result; }
PropertyDescriptorCollection ICustomTypeDescriptor.GetProperties(Attribute[] attributes) { PropertyDescriptorCollection pdc = new PropertyDescriptorCollection(new PropertyDescriptor[0]); foreach (PropertyDescriptor pd in TypeDescriptor.GetProperties(this)) { pdc.Add(pd); } foreach (String key in CustomProperties.Keys) { pdc.Add(new DictionaryPropertyDescriptor(CustomProperties, key, attributes)); } return pdc; }
public override PropertyDescriptorCollection GetProperties(ITypeDescriptorContext context, object value, Attribute[] attributes) { //var cols = base.GetProperties(); var props = new PropertyDescriptorCollection(null); foreach (FieldInfo fi in value.GetType().GetFields()) { var prop = new MyPropertyDesciptor(fi, attributes); props.Add(prop); if (fi.FieldType.Namespace == "System.Collections.Generic") { Type[] args = fi.FieldType.GetGenericArguments(); foreach (Type arg in args) MyCustomTypeDescriptor.modifyNonSystemTypes(arg); } { MyCustomTypeDescriptor.modifyNonSystemTypes(fi.FieldType); } } if (props.Count > 0) return props; return base.GetProperties(context, value, attributes); }
public override PropertyDescriptorCollection GetProperties(Attribute[] attributes) { PropertyDescriptorCollection descriptorCollection = new PropertyDescriptorCollection((PropertyDescriptor[])null); foreach (PropertyDescriptor parent in TypeDescriptor.GetProperties((object) this.provider.UserProvider, attributes, false)) descriptorCollection.Add((PropertyDescriptor)new FQProviderPropertyDescriptor(parent)); return descriptorCollection; }
/// <summary> /// Loops through keep alive parameters. /// </summary> /// <param name="context">An ITypeDescriptorContext that provides a format context.</param> /// <param name="value">An Object that specifies the type of array for which to get properties.</param> /// <param name="attributes">An array of type Attribute that is used as a filter.</param> /// <returns>Collection of properties exposed to this data type.</returns> public override PropertyDescriptorCollection GetProperties(ITypeDescriptorContext context, object value, Attribute[] attributes) { GXKeepalive target = value as GXKeepalive; PropertyDescriptorCollection pds = new PropertyDescriptorCollection(null); foreach (PropertyDescriptor pd in TypeDescriptor.GetProperties(value)) { if (pd.IsBrowsable) { //If interval field is not shown. if ((target.Ignore & KeepaliveFieldsIgnored.Interval) != 0 && pd.Name == "Interval") { continue; } //If target field is not shown. if ((target.Ignore & KeepaliveFieldsIgnored.Target) != 0 && pd.Name == "Target") { continue; } //If target field is not shown. if ((target.Ignore & KeepaliveFieldsIgnored.Reset) != 0 && pd.Name == "TransactionResets") { continue; } pds.Add(pd); } } return pds; }
public override PropertyDescriptorCollection GetProperties(Attribute[] attributes) { var cols = base.GetProperties(); var props = new PropertyDescriptorCollection(null); foreach (FieldInfo fi in _instance.GetType().GetFields()) { var prop = new MyPropertyDesciptor(fi, attributes); props.Add(prop); if (fi.FieldType.Namespace == "System.Collections.Generic") { Type[] args = fi.FieldType.GetGenericArguments(); foreach (Type arg in args) modifyNonSystemTypes(arg); } else { modifyNonSystemTypes(fi.FieldType); } } // Return the computed properties return props; }
public PropertyDescriptorCollection GetProperties(Attribute[] attributes) { PropertyDescriptorCollection descriptorCollection = new PropertyDescriptorCollection((PropertyDescriptor[])null); foreach (ScriptProperty property in this.settings.ScriptProperties.Values) descriptorCollection.Add((PropertyDescriptor)new ScriptPropertyDescriptor(property)); return descriptorCollection; }
/// <summary> /// Retourne la collection des propriétés à afficher pour l'objet /// </summary> /// <remarks> /// Cette méthode ajoute le descripteur de la propriété "Name" uniquement pour les objets qui sont au moins <see cref="Control"/>. /// </remarks> /// <param name="component">objet dont les propriétés sont à afficher</param> /// <param name="attributes">null ou tableau de filtrage selon les attributs</param> /// <returns>la collection des descripteurs des propriétés à afficher</returns> public override PropertyDescriptorCollection GetProperties( object component, System.Attribute[] attributes ) { PropertyDescriptorCollection properties; // récupérer le propriétés à partir du descripteur de type if ( attributes == null ) attributes = DefaultFilter ; properties = TypeDescriptor.GetProperties( component, attributes ); // l'objet dont les propriétés sont à afficher n'est pas Control --> rien d'autre à faire if (! (component is Control) ) return properties; // si la propriété Name figure déjà dans la collection --> rien d'autre à faire PropertyDescriptor oldDescriptorOfName = properties.Find( "Name", false ) ; if (oldDescriptorOfName != null) return properties ; // rechercher le descripteur de la propriété Name dans la collection de tous les descripteurs de propriétés PropertyDescriptorCollection allProperties = TypeDescriptor.GetProperties( component ); oldDescriptorOfName = allProperties.Find( "Name", false ); if ( oldDescriptorOfName == null ) return properties; // composer le nouveau descripteur de la propriété Name PropertyDescriptor newDescriptorOfName = TypeDescriptor.CreateProperty( oldDescriptorOfName.ComponentType, oldDescriptorOfName, new ParenthesizePropertyNameAttribute( true ), CategoryAttribute.Design ); //PropertyDescriptor newDescriptorOfName = TypeDescriptor.CreateProperty( oldDescriptorOfName.ComponentType, oldDescriptorOfName, BrowsableAttribute.Yes, new ParenthesizePropertyNameAttribute( true ), CategoryAttribute.Design ); // composer la collection des descripteurs de propriétés obtenu en ajoutant le descripteur de la propriété Name PropertyDescriptor[] propertiesArray = new PropertyDescriptor[ properties.Count ]; properties.CopyTo( propertiesArray, 0 ); properties = new PropertyDescriptorCollection( propertiesArray ); properties.Add( newDescriptorOfName ); return properties; }
public override PropertyDescriptorCollection GetProperties(ITypeDescriptorContext context, object value, Attribute[] attributes) { //var cols = base.GetProperties(); var props = new PropertyDescriptorCollection(null); foreach (FieldInfo fi in value.GetType().GetFields()) { var prop = new WsdlFieldDescriptor(fi, attributes); props.Add(prop); if (fi.FieldType.BaseType.FullName == "System.Array") { TypeDescriptor.AddAttributes(fi.FieldType, new TypeConverterAttribute(typeof(ArrayConverter))); Type elemType = fi.FieldType.GetElementType(); TypeDescriptorModifier.modifyType(elemType); } else if (fi.FieldType.BaseType.FullName == "System.Enum") { } else { TypeDescriptorModifier.modifyType(fi.FieldType); } } if (props.Count > 0) return props; return base.GetProperties(context, value, attributes); }
public override PropertyDescriptorCollection GetProperties(Attribute[] attributes) { PropertyDescriptorCollection descriptorCollection = new PropertyDescriptorCollection((PropertyDescriptor[])null); foreach (PropertyDescriptor parent in TypeDescriptor.GetProperties(this.component, attributes, false)) descriptorCollection.Add((PropertyDescriptor)new ReadOnlyPropertyDescriptor(parent)); return descriptorCollection; }
public override PropertyDescriptorCollection GetProperties(ITypeDescriptorContext context, object value, Attribute[] attributes) { PropertyDescriptorCollection descriptorCollection = new PropertyDescriptorCollection((PropertyDescriptor[])null); foreach (PropertyDescriptor parent in this.parent.GetProperties(context, value, attributes)) descriptorCollection.Add((PropertyDescriptor)new ReadOnlyPropertyDescriptor(parent)); return descriptorCollection; }
/// <summary> /// Adds pseudo-properties for the specified component. /// </summary> /// <param name="context">An <see cref="T:System.ComponentModel.ITypeDescriptorContext" /> /// that indicates the context to retrieve properties from.</param> /// <param name="component">The component to retrieve properties from.</param> /// <param name="attributes">An array of type <see cref="T:System.Attribute" /> that indicates the /// attributes of the properties to retrieve.</param> /// <param name="originalCollection">The original property descriptor collection.</param> /// <returns> /// A <see cref="T:System.ComponentModel.PropertyDescriptorCollection" /> /// that contains the properties matching the specified context and attributes. /// </returns> protected override PropertyDescriptorCollection AddPseudoProperties( ITypeDescriptorContext context, object component, Attribute[] attributes, PropertyDescriptorCollection originalCollection) { originalCollection.Add(new TypePropertyDescriptor(component)); return originalCollection; }
public TopicViewProp(Topic item) { obj=item; obj.Subscribe("+", obj_changed); propsColl=new PropertyDescriptorCollection(null); foreach(PropertyDescriptor pr in TypeDescriptor.GetProperties(this.obj)) { if(obj.valueType!=null || pr.Category!="Content") { propsColl.Add(pr); } } foreach(Topic tp in obj.children) { if(tp.name=="_declarer" || tp.name=="_location" || tp.valueType==null) { continue; } PropertyDescriptor np=new DVarPropertyDescriptor(tp); propsColl.Add(np); } }
public override PropertyDescriptorCollection GetProperties(Attribute[] attributes) { PropertyDescriptorCollection propertyDescriptorCollection = new PropertyDescriptorCollection(null); foreach (PropertyDescriptor parent in TypeDescriptor.GetProperties(this.provider.UserProvider, attributes, false)) { propertyDescriptorCollection.Add(new SQProviderPropertyDescriptor(parent)); } return propertyDescriptorCollection; }
public override PropertyDescriptorCollection GetProperties( ITypeDescriptorContext context, Object value, Attribute[] attributes ) { PropertyDescriptorCollection buffClassProps; PropertyDescriptorCollection buffProps = TypeDescriptor.GetProperties( value, attributes, true ); buffClassProps = new PropertyDescriptorCollection( null ); foreach ( PropertyDescriptor oPD in buffProps ) { buffClassProps.Add( new SelectedEventEntryPropertyDescriptor( oPD ) ); } return buffClassProps; }
private static PropertyDescriptorCollection FilterProperties(PropertyDescriptorCollection props) { var ret = new PropertyDescriptorCollection(null); foreach (PropertyDescriptor desc in props) { if (desc.Attributes.Contains(DetailedAttribute.DetailedInstance) == false) ret.Add(desc); } return ret; }
PropertyDescriptorCollection ICustomTypeDescriptor.GetProperties(Attribute[] attributes) { PropertyDescriptorCollection pdc = new PropertyDescriptorCollection(new PropertyDescriptor[0]); foreach (PropertyDescriptor pd in TypeDescriptor.GetProperties(this)) { pdc.Add(pd); } //put Position property on top PropertyDescriptor posd = pdc["pPosition"]; pdc.Remove(posd); pdc.Insert(0, posd); foreach (String key in CustomProperties.Keys) { pdc.Add(new DictionaryPropertyDescriptor(CustomProperties, key, attributes)); } return pdc; }
public override PropertyDescriptorCollection GetProperties(Attribute[] attributes) { PropertyDescriptor pd; var pdc = new PropertyDescriptorCollection(base.GetProperties(attributes).Cast<PropertyDescriptor>().ToArray()); if ((pd = pdc.Find("Source", false)) != null) { pdc.Add(TypeDescriptor.CreateProperty(typeof(Binding), pd, new Attribute[] { new DefaultValueAttribute("null") })); pdc.Remove(pd); } return pdc; }
private static void GetProvidedProperties(ORMTypes selectedTypes, object extendableElement, PropertyDescriptorCollection properties) { foreach (CustomPropertyDefinition customPropertyDefinition in ((ModelElement)extendableElement).Store.ElementDirectory.FindElements<CustomPropertyDefinition>()) { if ((customPropertyDefinition.ORMTypes & selectedTypes) == 0) { continue; } properties.Add(CustomPropertyDescriptor.GetDescriptorForCustomPropertyDefinition(customPropertyDefinition)); } }
public override PropertyDescriptorCollection GetProperties(ITypeDescriptorContext context, object value, Attribute[] attributes) { List<bool> list=value as List<bool>; if(list==null) return base.GetProperties(context, value, attributes); Attribute[] propAttributes=new Attribute[] { new DescriptionAttribute(Properties.Resources.BoolInListDescription) }; PropertyDescriptorCollection props=new PropertyDescriptorCollection(null); for(int i=0; i<list.Count; i++) props.Add(new TypeInTypedListPropertyDescriptor<bool>(list, i, propAttributes)); return props; }
public override PropertyDescriptorCollection GetProperties(ITypeDescriptorContext context, object instance, Attribute[] filters) { PropertyDescriptorCollection collection = new PropertyDescriptorCollection(null); PropertyDescriptorCollection properies = TypeDescriptor.GetProperties(instance, filters, true); foreach (PropertyDescriptor desc in properies) { collection.Add(new PropertyDisplayPropertyDescriptor(desc)); } return collection; }
private void CheckAndAddProperty(PSPropertyInfo propertyInfo, Attribute[] attributes, ref PropertyDescriptorCollection returnValue) { using (typeDescriptor.TraceScope("Checking property \"{0}\".", new object[] { propertyInfo.Name })) { if (!propertyInfo.IsGettable) { typeDescriptor.WriteLine("Property \"{0}\" is write-only so it has been skipped.", new object[] { propertyInfo.Name }); } else { AttributeCollection propertyAttributes = null; Type propertyType = typeof(object); if ((attributes != null) && (attributes.Length != 0)) { PSProperty property = propertyInfo as PSProperty; if (property != null) { DotNetAdapter.PropertyCacheEntry adapterData = property.adapterData as DotNetAdapter.PropertyCacheEntry; if (adapterData == null) { typeDescriptor.WriteLine("Skipping attribute check for property \"{0}\" because it is an adapted property (not a .NET property).", new object[] { property.Name }); } else if (property.isDeserialized) { typeDescriptor.WriteLine("Skipping attribute check for property \"{0}\" because it has been deserialized.", new object[] { property.Name }); } else { propertyType = adapterData.propertyType; propertyAttributes = adapterData.Attributes; foreach (Attribute attribute in attributes) { if (!propertyAttributes.Contains(attribute)) { typeDescriptor.WriteLine("Property \"{0}\" does not contain attribute \"{1}\" so it has been skipped.", new object[] { property.Name, attribute }); return; } } } } } if (propertyAttributes == null) { propertyAttributes = new AttributeCollection(new Attribute[0]); } typeDescriptor.WriteLine("Adding property \"{0}\".", new object[] { propertyInfo.Name }); PSObjectPropertyDescriptor descriptor = new PSObjectPropertyDescriptor(propertyInfo.Name, propertyType, !propertyInfo.IsSettable, propertyAttributes); descriptor.SettingValueException += this.SettingValueException; descriptor.GettingValueException += this.GettingValueException; returnValue.Add(descriptor); } } }
public PropertyDescriptorCollection GetProperties(Attribute[] attributes) { PropertyDescriptorCollection pds = new PropertyDescriptorCollection(null); for (int i = 0; i < this.List.Count; i++) { AppSettingDescriptor pd = new AppSettingDescriptor(this[i], attributes); //TypeDescriptor.AddAttributes(pd, new CategoryAttribute("更改")); pds.Add(pd); } return pds; }
public override PropertyDescriptorCollection GetProperties(ITypeDescriptorContext context, object value, Attribute[] attributes) { ISite serviceProvider = null; IComponent component = PropertyDescriptorUtils.GetComponent(context); if (component != null) { serviceProvider = component.Site; } PropertyDescriptorCollection descriptors = new PropertyDescriptorCollection(null); descriptors.Add(new RuleSetPropertyDescriptor(serviceProvider, TypeDescriptor.CreateProperty(typeof(RuleSet), "RuleSet Definition", typeof(RuleSet), new Attribute[] { new DesignerSerializationVisibilityAttribute(DesignerSerializationVisibility.Content), DesignOnlyAttribute.Yes }))); return descriptors; }
public override PropertyDescriptorCollection GetProperties(ITypeDescriptorContext context, object value, Attribute[] attributes) { PropertyDescriptorCollection propertyDescriptorCollection = new PropertyDescriptorCollection(null); AltIDGroupList altIDGroupList = (AltIDGroupList)value; int num = 0; foreach (AltIDGroup group in altIDGroupList) { AltIDGroupPropertyDescriptor value2 = new AltIDGroupPropertyDescriptor(group, num++); propertyDescriptorCollection.Add(value2); } return propertyDescriptorCollection; }
public PropertyDescriptorCollection GetProperties() { var pds = new PropertyDescriptorCollection(null); for (var i = 0; i < Instance.Count; i++) { PropertyDescriptor pd = new ProjectSpecificFileCollectionPropertyDescriptor(Instance, i); pds.Add(pd); } return pds; }
/// <summary> /// Add text properties to the collection. /// </summary> public override PropertyDescriptorCollection GetProperties(ITypeDescriptorContext context, object value, Attribute[] attributes) { PropertyDescriptorCollection pds = new PropertyDescriptorCollection(null); PropertyDescriptorCollection _pdc = TypeDescriptor.GetProperties(value.GetType()); foreach (PropertyDescriptor pd in _pdc) { if (pd.IsBrowsable && pd.Attributes[typeof(GXTableColumnAttribute)] != null) { pds.Add(pd); } } return pds; }
public PropertyDescriptorCollection GetProperties() { if (globalizedProps == null) { PropertyDescriptorCollection baseProps = TypeDescriptor.GetProperties(this, true); globalizedProps = new PropertyDescriptorCollection(null); foreach (PropertyDescriptor oProp in baseProps) { globalizedProps.Add(new BasePropertyDescriptor(oProp)); } } return globalizedProps; }
/// <summary>Gets a collection of properties for the type of array specified by the value parameter.</summary> /// <returns>A <see cref="T:System.ComponentModel.PropertyDescriptorCollection" /> with the properties that are exposed for an array, or null if there are no properties.</returns> /// <param name="context">An <see cref="T:System.ComponentModel.ITypeDescriptorContext" /> that provides a format context. </param> /// <param name="value">An <see cref="T:System.Object" /> that specifies the type of array to get the properties for. </param> /// <param name="attributes">An array of type <see cref="T:System.Attribute" /> that will be used as a filter. </param> public override PropertyDescriptorCollection GetProperties(ITypeDescriptorContext context, object value, Attribute[] attributes) { if (value == null) { throw new NullReferenceException(); } PropertyDescriptorCollection propertyDescriptorCollection = new PropertyDescriptorCollection(null); if (value is Array) { Array array = (Array)value; for (int i = 0; i < array.Length; i++) { propertyDescriptorCollection.Add(new ArrayPropertyDescriptor(i, array.GetType())); } } return(propertyDescriptorCollection); }
public static PropertyDescriptorCollection GetProperties (Type componentType, Attribute[] attributes) { lock (typeof(TypeDescriptor)) { TypeElement element = GetOrCreateElement(componentType); if (element.properties != null) { return(element.properties); } PropertyDescriptorCollection coll; coll = new PropertyDescriptorCollection(null); foreach (PropertyInfo property in componentType.GetProperties()) { coll.Add(new BuiltinPropertyDescriptor (property, attributes)); } element.properties = coll; return(coll); } }