Type Converters to the rescue.

Issue:
We had a a requirement to make our property grid Read only,the out of the box propertygrid provided by the .net framework even disable the ellipses button for a collection property of my class(array…etc) so there is no other way of looking into all the collection elements.

Solution:
Create a TypeConverter class and overwrite the CanConvertTo and ConverTo methods, what i did was i Converted the array into a delimited sting and decoreated my class property with this coverter class and now in the propertyGrid is see a delimited string instead of a collection object.

the example is as follows…..

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: