Reputation: 8636
Anyone faced a problem while creating a UserControl in a library then drop it in a Form project...change this control's e.g. BackColor and rebuilding, changes are not reflecting in the Form project?
EDITED: when updating the control e.g. change controls, drop new controls inside the control, updating is happening. Looks like the controls backcolor stay static, or change only once.
This is so lame, and I'm so tired trying to find what is the problem!
I use VS2010 Ultimate, Windows 7 x64.
I found while dropping the control, adds in the designr initialization about the backcolor. If i delete this it works. How bad is that? It looks like a bug to me? is it?
You can do this only once!
Upvotes: 1
Views: 4077
Reputation: 14561
The BackColor property you set in the control designer and the BackColor property you set in the Form designer is the same property, the the one in the control designer acting as the default. The form designer sets it explicitly, yes, so you need to re-set it if you change the default.
You'll find that if you re-add the control, it will have the proper background colour.
To fix it, just change the property in the form to the right colour.
Upvotes: 0
Reputation: 887807
This is a bug in VS2010.
When you add a custom control to a designer in the same project, VS will add a reference to the project itself.
After adding a control to a designer in the same project, you should delete this reference.
Upvotes: 5
Reputation: 887807
If the two projects are in the same solution, change the reference to a Project Reference (Add Reference, Projects tab) and try re-building the entire solution.
Otherwise, build the library and the form, in that order.
Upvotes: 0