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