rbulph Posted November 11, 2008 Posted November 11, 2008 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? Quote
Administrators PlausiblyDamp Posted November 11, 2008 Administrators Posted November 11, 2008 IIRC you need to look at using a TypeConverter on the property http://msdn.microsoft.com/en-us/library/system.componentmodel.typeconverter.aspx gives some info. Quote Posting Guidelines FAQ Post Formatting Intellectuals solve problems; geniuses prevent them. -- Albert Einstein
rbulph Posted November 13, 2008 Author Posted November 13, 2008 (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 November 13, 2008 by rbulph Quote
rbulph Posted November 13, 2008 Author Posted November 13, 2008 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. Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.