Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

DevExpress MVC: can't use custom theme

I am using DevExpress MVC and want to use a custom theme. I got it working to use a standard theme but it can't find my custom one.

I've created the custom theme using the ASP.NET 12.1 Theme Builder and copied it in my project to App_Themes/MyTheme

I've added it using this code:

[Web.config]

<devExpress>
    ...
    <themes enableThemesAssembly="true" styleSheetTheme="" theme="MyTheme" />
    ...
</devExpress>

[Global.asax.cs]

protected void Application_PreRequestHandlerExecute(object sender, EventArgs e)
    {
        DevExpressHelper.Theme = "MyTheme";
    }

[_Layout.cshtml]

     @Html.DevExpress().GetStyleSheets( 
        new StyleSheet { ExtensionSuite = ExtensionSuite.NavigationAndLayout, Theme ="MyTheme" }, 
        new StyleSheet { ExtensionSuite = ExtensionSuite.Editors, Theme ="MyTheme" }, 
        new StyleSheet { ExtensionSuite = ExtensionSuite.HtmlEditor, Theme ="MyTheme" }, 
        new StyleSheet { ExtensionSuite = ExtensionSuite.GridView, Theme ="MyTheme" }, 
        new StyleSheet { ExtensionSuite = ExtensionSuite.PivotGrid, Theme ="MyTheme" },
        new StyleSheet { ExtensionSuite = ExtensionSuite.Chart, Theme ="MyTheme" },
        new StyleSheet { ExtensionSuite = ExtensionSuite.Report, Theme ="MyTheme" },
        new StyleSheet { ExtensionSuite = ExtensionSuite.Scheduler, Theme ="MyTheme"  }
    )

[Index.cshtml]

@Html.DevExpress().GridView(
    settings =>
        {
            ...
            settings.Theme = "MyTheme";
            ...
  }).Bind(Model.SearchResult).GetHtml()

When I use "Aqua" (standard theme) instead of "MyTheme" my control will be displayed in the Aqua theme. Using "MyTheme" first it just displayed the default standard theme, now it says "Cannot find the 'MyTheme' theme."

Can someone please help me? Thanks, Janina

like image 929
Janina Avatar asked Nov 15 '12 14:11

Janina


1 Answers

Make sure you have compiled your theme and added a reference to it in your bin folder.

It is described in the documentation here

like image 62
MikeB Avatar answered Oct 13 '22 12:10

MikeB