In This Topic
In an application, themes can come from the following sources:
- Standard C1 themes embedded as resources into the C1.Win.C1Themes.4.5.2 assembly;
- Themes which you create using the C1ThemeDesigner application, and add as embedded resources into your own assemblies;
- Themes which are loaded at runtime from .c1theme file(s).
The first two theme sources are available at design time via the C1ThemeController properties and designer actions. At runtime, you can also load themes in code from .c1theme files on disk using methods available on the C1ThemeController component.
The built-in themes can be applied through code using the RegisterTheme and SetTheme methods and ApplicationTheme property of the C1ThemeController class. With the RegisterTheme method, the user can load a built-in theme from a file and register it for use by theme controllers in the application. The SetTheme method can be used to set control-wise themes, while the Application Theme property can set an application-wide theme, so that all the controls in an application that have "(default)" as their Theme property will use the same theme.
'Register the theme file with the C1ThemeController
C1.Win.C1Themes.C1ThemeController.RegisterTheme("C:\Users\Documents\Visual Studio 2010\Projects\ThemesBuild6\ThemesBuild6\NewOffice2013White.c1theme")
'Apply it to a control, use the theme name, not the file name
Me.C1ThemeController1.SetTheme(someControl, "NewOffice2013White")
//Register the theme file with the C1ThemeController
C1.Win.C1Themes.C1ThemeController.RegisterTheme(@"C:\Users\Documents\Visual Studio 2010\Projects\ThemesBuild6\ThemesBuild6\NewOffice2013White.c1theme");
//Apply it to a control and use the theme name
this.c1ThemeController1.SetTheme(somecontrol, "NewOffice2013White");
'Sets the specified theme as the default application theme by C1ThemeControllers
C1ThemeController.ApplicationTheme = "GreenHouse"
//Sets the specified theme as the default application theme for C1ThemeControllers
C1ThemeController.ApplicationTheme = "GreenHouse";