Using a Custom Theme Assembly

  • 2 minutes to read

In this topic, you will learn how to use a custom theme to customize the appearance of a website. As an example, we will use a custom MyThemeAssembly assembly that contains the MyDevExTheme theme described in the Creating a New Theme and Generating a Custom Theme Assembly topics.

To apply a custom theme assembly to your application, it is necessary to add a theme assembly to the project's reference files. All required source files (images, CSS files, and skins) are automatically obtained from the theme assembly.

Start by adding the required file to your application.

 

  1. Right-click your site in Solution Explorer and select Add | Reference....

  2. Click the Browse tab in the Reference Manager. Then click the Browse... button and add the MyThemeAssembly.dll assembly to the manager. After the assembly appears in the Reference Manager, check it and click OK.

    ASPxThemeBuilder-AddRefDialog

    This adds the assembly to the project.

  3. Assign the assembly name (MyThemeAssembly) to the customThemeAssemblies option within the devExpress section of the web.config file.

    <devExpress>
         <themes customThemeAssemblies="MyThemeAssembly" ... />
         ...
    </devExpress>
    
  4. You can now apply the MyDevExTheme theme to a website. For this purpose, set the theme attribute within the devExpress section of the web.config file to MyDevExTheme.

    
    <devExpress>
         <themes enableThemesAssembly="true" styleSheetTheme="" customThemeAssemblies="MyThemeAssembly" theme="MyDevExTheme" />
         ...
    </devExpress>
    
  5. Run the application and view your site with the MyDevExTheme theme.
NOTE

You can use the DevExpress ASP.NET Project Wizard to specify a theme for your site. The Wizard automatically adds a reference to an assembly in your project, and sets the customThemeAssemblies and theme attributes of web.config.

See Also