I have class (ClassA) with some public properties. One of the properties (ClassBValue) is of a class type (ClassB) which has some public properties, too. Now I want to show ClassA objects in a PropertyGrid. I use the
[TypeConverter(typeof(ExpandableObjectConverter))]
Attribute for the ClassB property of ClassA.
The problem is, that the ClassBValue property is null when it is shown in the PropertyGrid. How can I enable the user to create a ClassB object within the PropertyGrid? The user should be able to set a value for the ClassBValue and edit the sub-properties and also to delete the value (set it to null).
null
I already tried to implement a type converter inherited from ExpandableObjectConverter that converts from/to string. But then the user has to enter a string in the correct format to create ClassB object value. That is not intuitive and ergonomic. Any hints for doing it better?