Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
1170
Default theme for all forms
posted

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

Parents
No Data
Reply
  • 469350
    Verified Answer
    Offline posted

    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.

Children