Peter17
Peter17

Reputation: 3102

How to show or hide properties dynamically in the PropertyGrid?

I am using a PropertyGrid for configuring objects. I need to be able to hide or show some properties depending on the values of other properties. How this can be achieved? I know about Browsable attribute, but it only works at a compile time.

Upvotes: 5

Views: 9451

Answers (2)

Rajeev
Rajeev

Reputation: 1

Check this link Changing Browsable Property Attribute dynamically.A sample method is given. Using Reflection access the Property and set its browsable property to true or false.

Upvotes: -2

Oliver
Oliver

Reputation: 45109

Take a look into the ICustomTypeDescriptor Interface.

Further informations on how to use it can be found in this article:

Upvotes: 5

Related Questions