How do I filter the visible properties inside of a property grid's collection editor (win forms)?

StackOverflow https://stackoverflow.com/questions/5876966

문제

I have a property grid that points to an object to view its properties. I filter by doing the following:

            propertyGrid1.BrowsableAttributes = new System.ComponentModel.AttributeCollection(new Attribute[]
            {
                new CategoryAttribute("All")
            });

My object has a collection of Control objects. When I view just the object, all of the properties that don't have [Category("All")] are filtered out. So far so good. However when I go into the collections editor, that editor shows properties that are not marked with [Category("All")]. This is undesirable. How do I remedy this issue?

도움이 되었습니까?

해결책

i fear you will have to subclass the collectioneditor to do that ...

this article describes how to access the propertygrid on the form of the collection editor (see the overide of CreateCollectionForm in the article)

instead of registering eventhandlers you can setup your restriction for browsable attributes there ...

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top