My Blog

WinForms Filtered PropertyGrid

by host on mercoledì 17 marzo 2021 22:07

This example shows how to create a PropertyGrid in which there is a property search system, useful when the object managed by the PropertyGrid is made up of a large number of properties.

There are two paths that can be followed to implement this system:

  • Implement an object wrapper assigned to the PropertyGrid that implements the ICustomTypeDescriptor interface. This solution, besides being complex and having several side effects, has the disadvantage of having to rewrite part of the editors necessary to modify the properties using PropertyGrid .
  • Implement a TypeConverter to apply to the objects managed by the PropertyGrid , the only disadvantage of this solution is the fact of having to apply the TypeConverter to the classes that you want to manage using the PropertyGrid . Apart from this it is the ideal solution and it is the way implemented in this example.