I have a class Foo defined in a library which is used in the GUI project. The GUI project allows graphical editing of an instance of Foo with the help of a System.Windows.Forms.PropertyGrid
.
To make editing of an instance of class Foo in a PropertyGrid
comfortable, I have to set several attributes to Foo's properties, Browsable
for example.
However, I do not want to set up these attributes in Foo because the library it's in should have only the required things needed to use Foo in code (not in GUI).
How can I get a PropertyGrid
-friendly version of Foo?
I already tried inheriting from it (naming it FooDesignable) and shadowing its properties with the wanted attributes. However, that didn't work well very long until I discovered that Foo is using other custom classes of the library project which I then also had to shadow, and change the existing properties in Foo to return the XxxDesignable types.
Am I in a dead end here? Or am I just thinking bad about it?