Best practice when you need two user controls (winforms) to communicate

前端 未结 3 695
深忆病人
深忆病人 2021-02-10 12:28

Extended problem

I would like to add a new problem in addition to the original problem specified below. One of the user controls in the application cont

3条回答
  •  伪装坚强ぢ
    2021-02-10 13:03

    1. Expose the data it as a property.
    2. Create a property on the other user control that the parent form will populate with the reference to the control with the data.

    Pseudo code:

    public UserControlA uca { get; set; }
    ...
    
    var items = uca.Items;
    

提交回复
热议问题