Search code examples
c#.netpropertydescriptor

How to set default PropertyDescriptor to a property?


Are there an attribute for setting default PropertyDescriptor for a property? I just want to add a attribute to a property and specify PropertyDescriptor. And then the instance of the PropertyDescriptor would have been created. I haven't found the attribute in .net framework.


Solution

  • No, you can't. However, you could implement ICustomTypeDescriptor or (easier) inherit from CustomTypeDescriptor.

    If your objects are contained in a collection, you could make the collection implement ITypedList instead.