propertygrid - How to add a property to a c# class at runtime -


i created class propertygrid control looks this:

public class detailfilterproperties  {     public detailfilterproperties(treevieweventargs e)     {               ...     }      [categoryattribute("base"), descriptionattribute("filtered fields referring formatted yam field"), readonly(true)]     public dictionary<string, string> filteredfields     {         get;         set;     }      ... } 

at runtime want add string property (or list of strings) class can give me example of how please.

i browsed web , read expandoobject bet there easier way achieve this, didnt find example yet.

thanks in advance.

you can't actually add property c# class @ runtime; however, propertygrid respects flexible types via icustomtypedescriptor. can supply custom type descriptor either implementing interface directly (lots of work), or registring typedescriptionprovider (also lots of work). in either case, you'll have implement custom propertydescriptor, , think of somewhere data go.


Comments

Popular posts from this blog

javascript - RequestAnimationFrame not working when exiting fullscreen switching space on Safari -

Python ctypes access violation with const pointer arguments -