This is just a summary of how I overlooked this silly little thing that could have made my designer workings so much easier in the past: how to use the InstanceDescriptor (returned by a TypeConverter) to create a variable inside InitializeComponent and set the properties of that variable, instead of having to set everything inside the constructor. All that was needed, is to set that last parameter (isComplete) to false.
It's so incredible simple and effective, I still can't believe how I could have missed it all that time. Perhaps some of you out there have always been using it and wonder the same thing, but then again perhaps there are others who missed this in the same way and can be spared the same search and use of unneeded CodeDom solutions.
For a long time now, I've been wanting properties to be able to persist in the designer, where the property in this case is an instance. The easy way is to set the designerserializationvisibility to Content, but then you would always need an instance and that doesn't work when using properties with the
IExtenderProvider.
In comes the InstanceDescriptor. Creating one is fairly straight forward: by assigning a custom typeconverter to the type used by the property and enabling that typeconverter to return an InstanceDescriptor all properties using that type can be used (how the property is created in the designer is another thing. For example you can have the typeconverter create one automatically when text is typed by implement a convertFrom(string) )
However, I often ended up creating a bunch of constructors to suit the different scenarios without having to include all parameters all the time.
What I really wanted, was the designer to create a variable inside InitializeComponent, and use the default serialization on the properties of that variable. But I never could find any way besides using custom serialization with the CodeDomSerializer.
Then, one day, while trying to getting an InstanceDescriptor to work with a more dynamic construction by using a parameter array of settings in the constructor of my class, I tried setting the isComplete parameter to false. That didn't work for that, (I had to use an array of setting instances as parameter instead of loose setting instances), suddenly a variable appeared inside the InitializeComponent. Not only that, the properties that had to be saved, were indeed present.
Problem was, at that time I changed around several things and feared it was a fluke inside the IDE (yes, yes, me of little faith. I am indeed sorry), until I reviewed the changes and realized the power of that one parameter. By setting that one parameter to false, my class had become so much easier to maintain and could be an effective solution to so much more other past work arounds, that I just had to write this down here. A long story for such a thing and not likely to be read by much people, but at least it will be a reminder to self to keep re-exploring after the re-exploring of the exploring.