c# - Add a category attribute to a PropertyDescriptor -


I have a set of custom estate descriptors, which I also want to add categories so that they can add one more to a property grid Can be displayed in organized form. I want every type of property descriptor to go to a specific category.

I added typedisptor to add attributes for an existing property decanter. Attempted to use ADATEditus (), but the category attribute has not been added.

  Category entry internal property category = new rangeet ("internal properties"); CurrentDescriptor = New intrinsic property descriptor (def); TypeDescriptor.AddAttributes (current descriptor, new attribute [] {intrinsicPropertyCategory});  

I have a type-descriptor in the constructor as shown below for one of my property descriptors Have tried to use ADATASS (). But it does not work either.

  Public IntrinsicProperty Descriptor (IntrinsiProperty Def PRO Diff): Base (PrPK, PROFF properties) {this._type = propDef.Type; This._key = propDef.Key; This._readOnly = propDef.ReadOnly; Category entry internal property category = contribution of new category ("internal properties"); TypeDescriptor.AddAttributes (this, new feature [] {intrinsicPropertyCategory}); }  

I did not want to expand that time, why am I doing, what am I doing? But in the above example, IntrinsicPropertyDef is a class that defines a property including name, display name and type. Then include DisplayNameAttribute in propDef.Attributes.

An intrinsic property def can be displayed with two different custom property designers intrinsic property descriptor and intrinsic intrinspiropteri descriptor. Each intrinsic property descriptor should have a category attribute "internal property", and each InferedIntrinsicPropertyDescriptor should have a category attribute "Infrared Internal Properties".

I believe you only class Can override:

  public override string category {get {return "Foo"; }}  

for other scenarios; Normally with a custom PropertyDescriptor , you specify the attributes in the constructor to include the attribute [] logic to include the category entry Will need to be expanded. If you need to do any processing, you can use a static method - untested:

  static attribute [] AddCategory (attribute [] attributes, string categories) {Array.Resize (Ref specifications, attributes lamps + 1); Characteristics [attributes. Length - 1] = new category asset (category); Return features; } Public IntrinsicPropertyDescriptor (IntrinsicPropertyDef propDef): Base (PROPK, AddCategory (propDef.Attributes, "Foo")) {...}  

Also - note that To use property descriptor , the system must find it ... Resolution Rules are:

  • For PropertyGrid , TypeConverter
  • ICustomTypeDescriptor has been checked
  • For one type
  • Otherwise it is registered with a registered TypeDescriptionProvider < / Code> for A
  • Li> list:
    • IListSource is checked and resolved in a list (Processing is continuing)
    • ITypedList is checked
    • Other organizations are eroded, the list type is checked for the non-object indexer - that is to say < Code> Public This type of [int index] {get}}
      • If it is found then type properties
      • Otherwise, Etadeta not available

Comments

Popular posts from this blog

python - Overriding the save method in Django ModelForm -

html - CSS autoheight, but fit content to height of div -

qt - How to prevent QAudioInput from automatically boosting the master volume to 100%? -