Jump to content
Xtreme .Net Talk

PropertyGrid - suppressing expansion for an object reference.


Recommended Posts

Posted

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?

Posted (edited)
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. Edited by rbulph
Posted

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:

 

If prgOne.SelectedObject IsNot value Then Return Nothing

 

in the GetProperties override of the ExpandableObjectConverter.

 

If the user clicks on the + mark it disappears.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...