How to set default PropertyDescriptor to a property?
-
16-09-2019 - |
Question
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.
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow