Programmatically hiding properties in a PropertyGrid

I am looking to hide / show properties depending on what choices the user makes in the blob. I do a great job with this event, but really can't make the correct properties disappear. The solutions that I found on the line, mainly since 2005, and since I had very little experience, I thought that I should do something wrong if hiding properties is difficult.

So far, I have been trying to access the property after processing the event, but the ReadOnly and IsBrowsable properties are read-only.

The property of the property has the BrowsableAttributes property, which accepts a list of attributes, but works only negatively and cannot do or - and only. Providing a collection of attributes; the category is 'test' and isbrowable is true; returns those that match both, and since I cannot provide multiple attributes. I can’t make the search specific enough to hide the ones I need, leaving others visible.

I’ve been banging my head on the wall for several hours, thinking that there should be an easier way.

+3
source share
2 answers

You tried to apply this attribute to a property:

[Browsable (false)]
public object SomeProperty {
}

Therefore, it SomePropertydoes not appear in the properties.

+13

, , ICustomTypeDescriptor , PropertyGrid /, , PropertyGrid, , / ..

, , http://www.codeproject.com/KB/grid/PropertyGridDynamicProp.aspx.

, Code Project, Code Project. , , . , , , .

, , .

+4

All Articles