Hi,
I am working on a windows form application with as many as 300-400 forms and twice as many user controls. I am using infragistic's styling library to theme the forms in the application. I have created stylesets for some forms that require special handling. But since there are a lot of forms in the system, setting the styleset and stylelibrary name for each control in the form is a difficult job. My question is that if there is a way to set a default styleset for all the controls in a form if its "stylelibraryname" and "stylesetname" properties are not set?
This would reduce much effort and display a constant color scheme across the application. Your help is appreciated.
Regards
Ishan Gandhi
Hi Ishan,
By default, loading an application style library into memory will affect the entire application. There is no need to set the StyleSetName or StyleLibraryName on every control in the app.
If you are loading a style library and it's not affecting the controls, then my guess is that you are simply using the wrong overload of StyleManager.Load. When you load the style library, just specify the filename and nothing else. You do not need to specify a StyleLibraryName and doing so will limit which controls the library gets applied to.
The only time you need to specify a StyleLibraryName is if you want the library being loaded to only apply to SOME controls in your application and not to the majority of controls.
To answer your question, though... there is no way to set the StyleLibraryName at a form, usercontrol, or container level. It has to be applied to each control individually. So if you did need to set it, the best way to do that would be to create a method that walks over the controls recursively and sets the StyleLibraryName on each control.
I'm just following up on this. Did my response answer your question? Do you need any more clarification or do you have any follow up questions about this?