Hi,
I'm writng a control derived from UserControl (let's call this control
MyControl) that itself is meant to be derived further times.
MyControl hosts a public collection of specialized non-GUI objects.
This collection is therefore accesible from any controls derived from
MyControl. Derived controls have to be able to add, change and remove
objects from the collection.
In MyControl I set the DesignerVisibility to Content so that the
code-generation engine properly generates the code for the collection
and when I initialize MyControl, I add some objects to the collection.
Now, here's where the problem starts. The code generation for controls
derived from MyControl will generate code to create and add all
objects in the collection, even if some of these were added in
MyControl and there's already code (in MyControl) to create and add
them.
The situation is similar to that of the ControlCollection in Controls,
but here somehow, the code-generator doesn't add controls present in
the super-calss again.
I could not find any references or documentation of how to deal with
this, so I'm asking for some help. Has anybody had some experience
with this?
Sebastian
PS: I'll post some code if anybody needs an alternative explanation.
Thanks