Comment mettre PropertyDescriptor par défaut à une propriété?
-
16-09-2019 - |
Question
Y at-il un attribut pour la mise en PropertyDescriptor par défaut pour une propriété? Je veux juste ajouter un attribut à une propriété et spécifiez PropertyDescriptor. Et puis l'instance de PropertyDescriptor aurait été créé. Je ne l'ai pas trouvé l'attribut dans .NET Framework.
La solution
Non, vous ne pouvez pas. Cependant, vous pouvez mettre en œuvre ICustomTypeDescriptor
ou (plus facile) CustomTypeDescriptor
.
Si vos objets sont contenus dans une collection, vous pouvez faire la collection mettre en œuvre ITypedList
à la place.
Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow