I created a SubCtrl inheriting from UserControl. He has no code. I created then Ctrl, which also inherits UserControl. It has SubCtrl, and its only code is to publish it publicly, so it appears in the Ctrl property list:
public subctrl.SubCtrl SUBCTRL { get { return this.subCtrl1; } }
Then I created a simple form project in which there is only Ctrl and code. As I wanted, SUBCTRL appears in the Ctrl property list, so I can make a difference. I changed the background color (say red) and the subctrl turned red in the designer.
But magically, when I launch the project, it returns to the standard grays. It seems that no code is generated in Form1.Designer.cs to change the back side color of SUBCTRL to red. If I write this manually, it will work, but thatβs not what I want. It should be automatic, obviously.
Ctrl, on the other hand, behaves normally. Code is generated and everything works successfully.
What happened to the subcontrol?
c # user-controls windows-forms-designer
Gabriel
source share