I have the following structure: enter image description here

On the right side, class A is shown, which contains a property of type List; On the left side is a diagram of visual components of type UserControl, in a component of this type there is a Field, this field gets a value in the constructor of this component.

For example, class A looks like this:

public class A { public List<T> Property1 {get; set;}; } 

For example, the UserControl class looks like this:

  public sealed class UserControl_ : UserControl { public T Field; public UserControl_ (T field) { Field = field; } } 

Let there is a form Form1 and there is a method for creating UserControl (s):

  public void CreateControl(list<T> list) { foreach(item in list) { Controls.Add(new UserControl_(item)); } } 

I can manage class A properties through a PropertyGrid component. So what I need is: when I remove an element from the Property1 property of the List type (for example item 0), I need to remove the visual control of UserControl 1. If I have 10 elements in Property1, then UserControl (s) will be 10. Each element of Property1 contained in UserControl controls (one to one link)

How to be?

  • @Ev_Hyper, PropertyGrid is a control that allows you to edit the attributes of the class msdn.microsoft.com/ru-ru/library/… - Naf
  • So this is WindowsForms ... so they would have written right away - Ev_Hyper

0