How to know if multiple objects in ICustomTypeDescriptor implementation

  • Thread starter Thread starter Michael Kairys
  • Start date Start date
M

Michael Kairys

I want to customize the action of the property grid on a particular class so
that some properties are not displayed if multiple objects are selected -
i.e. if I used PropertyGrid.SelectedObjects instead of SelectedObject.

I see that the Forms Designer does this; for example if you select two
controls in a form you no longer see Name or TabIndex (which must be
unique).

It may be that the Forms Designer, being a Designer, is using the mysterious
IDesignerFilter.PreFilterProperties, which (I assume) would not help me in a
runtime dialog.

But be that as it may, this is my quest, and I would appreciate any advice.

________________________________________
Michael Kairys
Senior Engineer | SL Corporation | http://www.sl.com
 
Hi Michael,

What if you implement ICustomTypeDescriptor's GetProperties method to
dynamically change the number of properties returned depending on the number
and type of objects selected in the dialog? This will be your internal
filter.

Obviously, the ICustomTypeDescriptor implementor must be a custom class able
to retrieve the properties of any object (or a set of objects) and reflect
them as its own properties.
 
Hello, and thanks for your reply...
What if you implement ICustomTypeDescriptor's GetProperties method to
dynamically change the number of properties returned depending on the
number and type of objects selected in the dialog? This will be your
internal filter.

Obviously, the ICustomTypeDescriptor implementor must be a custom class
able to retrieve the properties of any object (or a set of objects) and
reflect them as its own properties.

This is my problem. How can the object which is about to be displayed in the
property grid get any information about the property grid in which it is
about to be displayed?

There is no context available in the GetProperties call, or any other method
in the ICustomTypeDescriptor interface.
 
Back
Top