I have a base class library which contains all the UI controls with extended capabilities.
Ex: XTextBox <---derived from------ TextBox XPanel <---derived from------ Panel XLabel <---derived from------ Label
I use this library in my client application for rendering the controls on the UI.
I have an AppConfig file which determines the font/color for my client application.
Now the issue am facing is when i set the font values to the controls in my base class library.
For ex: The backcolor of the XTextBox is read from a utility class CUtility which reads the color information from an exe.Config file
this.BackColor = CUtility.GetBackColor(); //this represents the XTextBox control.
Many a times the backcolor is not set for some UI Controls in the runtime(Ex: Panels and for some UI Controls)
However these colors are set if i do it from the UI designer.
Any ideas where am doing wrong.
The BackColor property is special, it is an 'ambient' property. If it was never assigned then it will automatically get the value of the parent's BackColor. That's very nice, it automatically makes all the child control background colors right when you change, say, the background color of the form. Other properties that behave this way are ForeColor, Cursor and Font.
Sounds like this is your problem. Start by looking at the BackColor property of the controls that don't color correctly in the Properties window. If it is shown in bold then right-click it and choose Reset. Looking at the InitializeComponent() method and searching for BackColor assignments is a quick way to find them all.
Next, check if your custom controls assign the BackColor property explicitly.
check CUtility.GetBackColor() is returning value while set to panel
Are you using Winforms or Web contros ?