[Expand]General Information
[Expand]WinForms Controls
[Collapse]ASP.NET Controls and MVC Extensions
 [Expand]Prerequisites
 [Expand]What's Installed
 [Collapse]Common Concepts
  [Expand]Web.config Modifications
  [Expand]Callback Exception Handling
  [Expand]Client-Side Functionality
  [Expand]Cookies Support
  [Collapse]Appearance Customization - Theming
    DevExpress Themes Overview
    Available Themes
    ASPxThemes Assembly
    Modifying Themes
    Changing Theme Base Color and Font Settings
    ASPxThemeDeployer Tool
    ASPxThemeBuilder Tool
    Apply a Theme with the DevExpress Mechanism
    Apply a Theme with the ASP.NET Mechanism
    Attaching a Custom Theme Assembly
    DevExpress Resource Management Mechanism
   [Expand]Obsolete Approaches (prior to 2012.1)
   Icon Collection
  [Expand]Performance Optimization
  [Expand]CSS Image Sprites
   Data Annotation Attributes
   Supported Document Types
  [Expand]Accessibility Support
   Right to Left Support
   HTML Encoding
  [Expand]SharePoint Support
   Mobile Support
  [Expand]Office Document Management
   Cloud Storage Account Management
  [Expand]Web Farm and Web Garden Support
 [Expand]ASP.NET WebForms Controls
 [Expand]ASP.NET MVC Extensions
 [Expand]Localization
 [Expand]Redistribution and Deployment
  Get More Help
 [Expand]API Reference
[Expand]ASP.NET Bootstrap Controls
[Expand]ASP.NET Core Bootstrap Controls
[Expand]WPF Controls
[Expand]Xamarin Controls
[Expand]Windows 10 App Controls
[Expand]Office File API
[Expand]Reporting
[Expand]Report and Dashboard Server
[Expand]Dashboard
[Expand]eXpressApp Framework
[Expand]eXpress Persistent Objects
[Expand]CodeRush
[Expand]CodeRush Classic
[Expand]Cross-Platform Core Libraries
[Expand]Tools and Utilities
 End-User Documentation
View this topic on docs.devexpress.com (Learn more)

Apply a Theme with the DevExpress Mechanism

DevExpress provides an easy way to theme your web application by applying a theme stored in a specific assembly.

When using a pre-packaged theme assembly (ASPxThemes) or a custom one, you are not required to copy theme-related files to your project. The required theme resource files (such as image, CSS and skin files) will automatically be obtained from the theme assembly. Add a reference to this assembly to your project, and register the assembly in the Web.config file to apply a theme from the custom assembly.

To apply a theme, specify the theme name of the website, web page or individual DevExpress control - as described in the corresponding sections below.

Expanded Apply a Theme to a Control

  • At design time:

    Specify a control's theme using its smart tag.

    In this case, the control's Theme property is set to the selected theme name. You can define the theme name directly in markup, as shown in the code sample below.

  • At runtime:

    Set the control’s ASPxWebControl.Theme property to the theme name in the Page.PreInit event handler.

Expanded Apply a Theme to a Web Page

  • At runtime:

    Set the ASPxWebControl.GlobalTheme property to the theme name in the Page.PreInit event handler.

Expanded Apply a Theme to a Website

  • At design time:

    Set the Theme Name attribute to the theme name in the themes configuration section in the Web.config file.

  • At runtime:

    Set the ASPxWebControl.GlobalTheme property to the theme name on each request execution by sepcifying the theme in the HttpApplication.PreRequestHandlerExecute event handler (in Global.asax).

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 as well.

Expanded Apply a Theme to a Sharepoint Web Part

When working with Sharepoint WebPart / VisualWebPart modules, override the CreateChildControls method to apply a theme – as shown below.

Expanded See Also

Is this topic helpful?​​​​​​​