当前位置: 首页>>代码示例>>C#>>正文


C# PropertyDescriptorCollection.Add方法代码示例

本文整理汇总了C#中System.ComponentModel.PropertyDescriptorCollection.Add方法的典型用法代码示例。如果您正苦于以下问题:C# PropertyDescriptorCollection.Add方法的具体用法?C# PropertyDescriptorCollection.Add怎么用?C# PropertyDescriptorCollection.Add使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在System.ComponentModel.PropertyDescriptorCollection的用法示例。


在下文中一共展示了PropertyDescriptorCollection.Add方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: GetProperties

 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" });
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:7,代码来源:RuleConditionReferenceTypeConverter.cs

示例2: FFTypeDescriptor

        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;
        }
开发者ID:supermuk,项目名称:iudico,代码行数:29,代码来源:PropertyGridUtils.cs

示例3: GetProperties

        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;
        }
开发者ID:name2name2,项目名称:mvvmlight,代码行数:25,代码来源:TestCustomTypeDescriptor.cs

示例4: PropertyDescriptorCollection

 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;
 }
开发者ID:rostok,项目名称:gleed2d,代码行数:13,代码来源:Layer.ICustomTypeDescriptor.cs

示例5: GetProperties

 /// <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;
 }
开发者ID:giapdangle,项目名称:Gurux.Device,代码行数:35,代码来源:GXKeepaliveConverter.cs

示例6: GetProperties

        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);
        }
开发者ID:nkarastamatis,项目名称:FieldsGrid,代码行数:26,代码来源:MyObjectShell.cs

示例7: GetProperties

		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;
		}
开发者ID:smther,项目名称:FreeOQ,代码行数:7,代码来源:ScriptSettingsTypeDescriptor.cs

示例8: GetProperties

		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;
		}
开发者ID:heber,项目名称:FreeOQ,代码行数:7,代码来源:FQProviderTypeDescriptor.cs

示例9: GetProperties

        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);
        }
开发者ID:nkarastamatis,项目名称:WebServiceTestStudio_Winforms,代码行数:29,代码来源:WsdlObjectConverter.cs

示例10: GetProperties

        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;
        }
开发者ID:nkarastamatis,项目名称:FieldsGrid,代码行数:25,代码来源:MyTypeDescriptionProvider.cs

示例11: GetProperties

    /// <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;
    }
开发者ID:NicolasR,项目名称:Composants,代码行数:39,代码来源:PropertyGrid.PropertyTabWithName.cs

示例12: GetProperties

		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;
		}
开发者ID:smther,项目名称:FreeOQ,代码行数:7,代码来源:ReadOnlyTypeDescriptor.cs

示例13: GetProperties

		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;
		}
开发者ID:smther,项目名称:FreeOQ,代码行数:7,代码来源:ReadOnlyExpandableObjectConverter.cs

示例14: AddPseudoProperties

 /// <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;
 }
开发者ID:odalet,项目名称:Hawkeye2,代码行数:20,代码来源:AllPropertiesTab.cs

示例15: TopicViewProp

 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);
   }
 }
开发者ID:giapdangle,项目名称:X13.Host,代码行数:17,代码来源:PropertyView.xaml.cs


注:本文中的System.ComponentModel.PropertyDescriptorCollection.Add方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。