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
Make sure you have compiled your theme and added a reference to it in your bin folder.
It is described in the documentation here
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With