Hello Alexander,
The fact that you will need the parent properties at designtime (like
position, size, and so on) makes me think that this is at runtime that
you want to hide the parent properties of your custom control. Is it
the case? If yes, you have three possibilities:
- Derive your class from ICustomTypeDescriptor and implement
GetProperties to return only the properties you want.
- If you use .Net 2, you can set this functionaly in a separate class
and use TypeDescriptionProvider to register your TypeDescriptor.
- Create your own TypeConverter and implement GetProperties to return
only the properties you want. Attach this converter to your type with
the TypeConverterAttribute.
The Property Grid Resource List will list you the right resources to
implement one of these solutions.
You will be able to implement a generic way of filtering the parent
properties. The PropertyDescriptor class gives you the ComponentType
property so that you know the type of the target instance.
Type.IsAssignableFrom will tell you if your property belongs to your
custom control or to an ancestor type.
Best regards,
Nicolas Cadilhac @ VisualHint (
http://www.visualhint.com)
Home of Smart FieldPackEditor.Net / DateTimePicker replacement (http://
www.visualhint.com/index.php/fieldpackeditor)
Home of Smart PropertyGrid for .Net and MFC (
http://www.visualhint.com/
index.php/propertygrid)
Microsoft PropertyGrid Resource List -
http://www.propertygridresourcelist.com