In the picture below, "MyCars" is a collection. If an object's property is a collection, then in a PropertyGrid, the value appears as the string "(Collection)" with a button to the right if the item is selected.
Is it possible to change the "(Collection)" value? If so, how? The reason I ask is because I have implemented a custom UITypeEditor for the object that will appear in the PropertyGrid in my program. So far, the button on the right appears but the text value is the same as the display name of the property. I'd like a different string to appear there.
Edit: for what it's worth, I know I can override the PaintValue
method from UITypeEditor and provide an icon, which I may end up doing if I can't solve this issue, but I'd still like to know if and how that "(Collection)" text can be changed.
This article Customized display of collection data in a PropertyGrid might be of help.
** UPDATE **
To provide a summarized version of the article (in the event of the link being unavailable), the steps involved in customizing display and description of collection content in a PropertyGrid are as follows:
PropertyDescriptor
.DisplayName
and description properties.ICustomTypeDescriptor
interface.GetProperties()
method.TypeConverter
derived objects provided by .NET or implement your own classes to customize the textual representation of your domain classes. Assign them to the appropriate classes or properties by using the TypeConverterAttribute
class.To globalize the PropertyGrid
data, property descriptors may be chained together (See also Globalized property grid).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With