PropertyGrid - suppressing expansion for an object reference.

rbulph

Junior Contributor
Joined
Feb 17, 2003
Messages
397
I've got a class that I want to display in the propertygrid. Some of its properties refer to other instances of the class. I'd like to display those properties in the grid using just the ToString value for the other instances. But what happens by default is that a plus/minus box appears to the left of the property and all the properties of the secondary object are listed if the user opens this up. The property grid can be opened up indefinitely and it gets to look really confusing.

How can I prevent the properties for the secondary object being expandable?
 
Well I have an ExpandableObjectConverter (which inherits from TypeConverter) for the class already, for various purposes, but I can't figure out how to remove it for the properties.
 
Last edited:
I've discovered that, while I can't stop the + mark from appearing, I can at least stop it from opening if the user clicks on it with code like this:

PHP:
If prgOne.SelectedObject IsNot value Then Return Nothing

in the GetProperties override of the ExpandableObjectConverter.

If the user clicks on the + mark it disappears.
 
Back
Top