I'm trying to edit complex objects in a PropertyGrid control. I add the ExpandableObjectConverter (or my own subclass when I need it) as the TypeConverter and it works fine.
The one thing I can't seem to figure out is this. The object itself will have its .ToString() representation next to it in the Grid. Then when I expand the object the attributes have the same. All can be editable. I want to disable editing of the ToString() object field, but keep the attributes editable.
So in the PropertyGrid it would look like this;
+ Color {(R,G,B,A) = (255,255,255,255)} --uneditable
Alpha 255 --editable
Blue 255 --editable
Green 255 --editable
Red 255 --editable
So far I haven't found a way to do this. If I try to make it ReadOnly the entire object becomes read only. If I specify my own ExpandableObjectConverter and state it cannot convert from a string, if the string is edited in the PropertyGrid it will still try to cast and then fail.
I essentially just want it so I can stop end users from editing the string and forcing them to edit the individual attributes instead, so that I don't have to write a string parser for every single class.
Is this possible, or is there another way of doing this I just haven't thought of?