I have a WinForms user control Host with a custom UI Editor.
Through that editor, a child control (Child) can be added to Host.
(The UI Editor creates Child and sets Child.Parent = Host)
Child is handled through a Holder<Child> helper class, which is set as Tag property of e.g. a ListViewItem.
The respective code – some of it, at least – gets added to the form: Holder is created, and set as Tag, which is enough to be created at runtime, too.
However, Child is not visible to the designer – it is displayed, but it can’t be selected, nor does it occur in the drop down list with controls for the parent form.
I would like to:
- see the
Childcontrol in the designer, so that I can modify properties - get notified if the control is removed
Is this possible?
[edit] Thanks all for your input. I’ve decided to skip the designer – I hoped to throw together something quickly, but apparently it requires more planning than I should allow myself to spend on it right now.
Use
this.Controls.Add(/*Instance of the child*/);on the host class. Then for the notification add event handler for the host’s ControlRemoved event (this.ControlRemoved += new ControlEventHandler(Host_ControlRemoved);).