Click here to Skip to main content
15,882,209 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
I, I've created a component with a collection of controls as property:
<pre lang="C#">[DesignerSerializationVisibility(DesignerSerializationVisibility.Content)]
        public List<Component> ControlsToNotTranslate

Then I've created an UserControl, added some controls to it: buttons and labels.
Now I want to add this buttons and labels to the collection of my component via a ConnectionEditor like tool, but when I try to add items to the collection in the Visual Studio Designer, it opens the collection editor and does not give me the chanche to add the already created buttons and labels.

How can I achieve this?


Usually my collection of controls won't contain all controls in the parent UserControl, but only a small amount of them, so I would prefere not to initialize the collection to all controls in the parent UserControl.


Updated 27-Sep-18 3:35am

1 solution

Please see if this helps you in some way, see that in the "TargetControls" property of the control that is in form1 you can select the controls of the same type, to appear all the controls is just to change the control code, where is ExampleControl you changes to Control.

Link to demo:!AmP2eCNNws8S9AOkUoWu3Iejj6Q8
Share this answer

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900