Saturday, March 7, 2009

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.....

No comments: