471,595 Members | 1,361 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,595 software developers and data experts.

Hiding a row in a PropertyGrid

Is it possible to hide a row within a PropertyGrid based upon the boolean
value of another row within the PropertyGrid? I am using VS2005 with .NET
Frameworks 2.0.

Jul 12 '07 #1
3 4200
Hello SteveT,

see this discussion: http://www.dotnet247.com/247referenc...33/165462.aspx
Is it possible to hide a row within a PropertyGrid based upon the
boolean value of another row within the PropertyGrid? I am using
VS2005 with .NET Frameworks 2.0.

Jul 12 '07 #2
Hi Steve,

This is not a trivial task. PropertyGrid exposes no interfaces to
manipulate its UI by removing/adding rows. Normally, PropertyGrid will use
Reflection to query the type/value on the SelectedObject and display one
property for a row. There is no easy way to tell PropertyGrid not to
display any row or add one row. PropertyGrid is not designed with this

If you really want to achieve this task, one workaround is hooking into the
Reflection process of PropertyGrid during querying the object types/values.
Before PropertyGrid queries the properties, it will first 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"

Note: this technology needs the modification to the selected object instead
of the PropertyGrid class.

Hope this helps.

Best regards,
Jeffrey Tan
Microsoft Online Community Support
Get notification to my posts through email? Please refer to

Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
This posting is provided "AS IS" with no warranties, and confers no rights.

Jul 12 '07 #3
Actually - I seem to recall that you can do this by adding a custom
property-tab and simply tweaking the PropertyDescriptorCollection;
various examples on the net... removing is simpler... to add you need
to create your own PropertyDescriptor. Plenty of examples of that

Jul 12 '07 #4

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

6 posts views Thread by Terry | last post: by
3 posts views Thread by Dave Girvitz | last post: by
1 post views Thread by ANDRES BECERRA | last post: by
1 post views Thread by Lance | last post: by
6 posts views Thread by Steve Teeples | last post: by
4 posts views Thread by phcmi | last post: by
reply views Thread by leo001 | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.