ok, I looked at my project again and the model is a bit different, sorry for the little confusion above:
I have a class A that derives from the RichTextBox. If I drag it from the Toolbox to a test form the Properties window does not have any hidden (grey) properties shown, as in your test as well.
Now, in another project, which is the part of the same solution, I have another class (B). That class B derivesfrom the class Amentioned above and in addition it has its own type converter. This is the class that shows grey properties in the Properties window and the problem is probably somewhere in the TypeConverter class.
Here is the source code of the type converter:
public class TypeConverter_B : TypeConverter
{
public TypeConverter_B()
{
}
/// <summary>
/// allows us to display the + symbol near the property name
/// </summary>
/// <param name="context"></param>
/// <returns></returns>
public override bool GetPropertiesSupported(ITypeDescriptorContext context)
{
return true;
}
public override PropertyDescriptorCollection GetProperties(ITypeDescriptorContext context, object value, Attribute[] attributes)
{
return TypeDescriptor.GetProperties(typeof(A));
}
}
I can see now that the problem is most likely with the TypeDescriptor.GetProperties method. It has another overload where I can pass attributes as a filter, and that what's missing I bet.
Thank you.
[EDIT]
ok, the problem is fixed by changing the line
return TypeDescriptor.GetProperties(typeof(A));
to
return TypeDescriptor.GetProperties(typeof(A), new Attribute[] { new BrowsableAttribute(true)});
[/EDIT]