Hide or show a property in a propertygrid

G

Guest

Using VS2005, is the a simple method to hide or show a property within a
propertygrid based upon the changing value of another property within the
propertygrid.

For example, if I change a boolean property to true then I'd like to show a
second property that only applies when the first property is true.
 
J

Jeffrey Tan[MSFT]

Hi Steve,

Thanks for your post.

Normally, PropertyGrid will query the static properties of the bound
object, and the properties can not be changed. However, before PropertyGrid
query the static properties, it will query if the object implement
ICustomTypeDescriptor interface. So we can use this interface as a hook to
dynamically add/remove properties.

The codeproject article below demonstrates this technology:
"Add (Remove) Items to (from) PropertyGrid at Runtime"
http://www.codeproject.com/cs/miscctrl/Dynamic_Propertygrid.asp

Hope this helps!

Best regards,
Jeffrey Tan
Microsoft Online Partner Support
Get Secure! - www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top