aspnet-11724-common-concepts-appearance-customization-theming-apply-a-theme-with-the-devexpress-mechanism.md
DevExpress provides an easy way to theme your web application via a theme stored in a specific assembly.
If you use a pre-packaged theme assembly (ASPxThemes), you are not required to copy theme-related files to the project. All required theme resource files (such as image, CSS and skin files) will automatically be obtained from the theme assembly. To apply a theme from a custom assembly, add an assembly reference to the project and register the assembly in the Web.config file.
To apply a theme, specify the theme name for a website, a web page or an individual DevExpress control - as described in the corresponding section below.
At design time:
At runtime:
At design time:
At runtime:
Note
You can use the Project Wizard to specify a theme for your site. This wizard sets the Theme Name attribute in the Web.config file. If a custom theme is specified, the wizard adds a reference to the theme assembly and sets the customThemeAssemblies attribute in the Web.config file.
When working with Sharepoint WebPart / VisualWebPart modules, override the CreateChildControls method to apply a theme – as shown below.
public class WEB_PART_OR_VISUAL_WEB_PART_CLASS_HERE : WebPart {
protected override void CreateChildControls() {
DevExpress.Web.ASPxWebControl.GlobalTheme = "Aqua";
...
//Create Child Controls Here
}
}
Public Class WEB_PART_OR_VISUAL_WEB_PART_CLASS_HERE
Inherits WebPart
Protected Overrides Sub CreateChildControls()
DevExpress.Web.ASPxWebControl.GlobalTheme = "Aqua"
...
'Create Child Controls Here
End Sub
End Class
See Also