I have solvented this issue using a TypeConverter in my components. The following line implement a custom TypeConverter for a component:
[
TypeConverter(typeof (MyCustomTypeConverter))]
The class called 'MyCustomTypeConverter' must inherits from the ExpandableObjectConverter class.
for example:
public class MyCustomTypeConverter: ExpandableObjectConverter
In this class, you must implement the use of Properties Attributes objects. Using properties attributes, you can to define an attribute or category called 'MyFilteredProperties' and looking for this to return in a PropertyDescriptor collection.
See more details at:
http://www.codeproject.com/csharp/wdzpropertygridutils.asp
10x to zeeuw for the article.
If you use the supplied code, you must to change some lines for hide unwanted properties.
At the public override PropertyDescriptorCollection GetProperties(ITypeDescriptorContext context, object value, Attribute[] attributes) function, you must to add some like this:
....
.... previous code ommited
// For each property use a property descriptor of
// our own that has custom behaviour.
ArrayList orderedPropertyAttributesList = new ArrayList();
foreach (PropertyDescriptor oProp in baseProps)
{
PropertyAttributes propertyAttributes = GetPropertyAttributes(oProp, value);
if (propertyAttributes.IsBrowsable && propertyAttributes.Category == "\rMyFilteredProperties")
{
orderedPropertyAttributesList.Add(propertyAttributes);
deluxeProps.Add(new PropertyDescriptorEx(oProp, propertyAttributes));
}
}
orderedPropertyAttributesList.Sort();
...
... subsecuent code removed....
Regards
[CFQüeb]