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?
Hi Mike,
Hello,
I noticed something peculiar using an Ultragrid,BeginUpdate() and EndUpdate().
However, when I apply the theme, the grid turns to black when the this method is executed. Whereas I have set the disable backcolor for the grid as well
What could be the issue here?
regards,
BeginUpdate tells the grid to stop painting itself. So if the operating system tells the control to paint in between the calls to BeginUpdate and EndUpdate, then the grid will end up turning solid black. So when using BeginUpdate and EndUpdate,, you should always use them in an atomic block of code. If you do something in between those two lines of code that attempts to force a paint, then it will cause a problem like you describe.