I have written a custom control derived from usercontrol and one of the
properties is a list of child objects using the List<> generic
(List<MyClass>). Using the
attribute, the property will show up in the properties grid for the control
and allows adding/removing items in the designer using the standard
Collection Editor. My control uses whats in that collection to dynamically
build child controls. Problem is that when that collection is edited, it is
serialized correctly and I can compile and run the application that uses the
control fine. It works. But at design time, the child controls will not be
created and displayed because the code that does that isn't called
(currently that code is in the handler for OnLoad). So, at design time, how
do I get my code to execute that actually creates the child controls?
Because the property is a collection (List<>), it doesn't really get "set"
so I can't add anything to its setter since that won't execute. It seems
that I need to be able to react to when something is added to my
List<MyClass> instance at design time but I don't know how to do that.
As a test, I created a simple int property and, in its setter, I run my code
that creates the child controls from the collection and it drew them fine at
design time when I set that test property. I really just need to know where
to hook up that code.