I'm using .NET C# with standard WinForms, not WPF.
I have this situation. I'm creating a user control for a month calendar, similar to the .NET one but with a little more functionality. I have a user control form, that fills with button objects representing dates. The buttons can be colored with different color depending on their state(selected, mouse over, weekend...)
The way I'd like it to work is extending the button class to accept states, which determine colors, rather than coloring them from the parent (user control) class. There are 10 colors at the moment and I'd really wouldn't like to mess up the user control code with coloring conditions.
Also I would like to select all the colors at design time, using browsable designer properties. The problem is that the designer shows only properties defined in the user control class, and not its children (buttons).
Is there any workaround for this problem? So to put it short I want to change colors using internal button properties, and to be able to select them at design time, using designer properties, and not hard coding them manually.
There are various things you can do here - you could (although it is a bad answer) expose the controls in question on the public interface - but I'm not sure that is a great idea.
Personally, I would just re-expose the properties I am interested in, perhaps putting them into a different
[Category(...)]
- making sure to have both setters and getters.A bit like: