【发布时间】:2019-07-02 05:34:00
【问题描述】:
我正在尝试自定义 DevExpress MVC 仪表板的外观。我想创建一个要使用的自定义调色板。目前我可以通过以下代码更改仪表板配色方案,但我想自定义默认调色板。
//Set color scheme of dashboard
ASPxWebClientUIControl.GlobalColorScheme = "dark";
另外,根据DevExpress Documentation,可以使用以下事件自定义调色板。
public event CustomPaletteWebEventHandler CustomPalette
如何实现?我将以下代码添加到 Global.asax.cs,但新图表的调色板没有改变。
namespace Analytics {
public class MvcApplication : System.Web.HttpApplication {
protected void Application_Start() {
DashboardConfig.RegisterService(RouteTable.Routes);
ColorPaletteConfig cpc = new ColorPaletteConfig();
cpc.CustomPalette += new CustomPaletteEventHandler(this.OnMyEvent);
}
private void OnMyEvent(object sender, CustomPaletteEventArgs e)
{
//Set value to e.Palette =
Color[] colors = { Color.AliceBlue, Color.BlueViolet, Color.DarkBlue};
DashboardPalette p = new DashboardPalette(colors);
e.Palette = p;
}
protected void Application_Error(object sender, EventArgs e) {
Exception exception = System.Web.HttpContext.Current.Server.GetLastError();
//TODO: Handle Exception
}
}
}
我的 ColorPaletteConfig 类
public class ColorPaletteConfig
{
public event CustomPaletteEventHandler CustomPalette;
}
【问题讨论】:
标签: devexpress dashboard devexpress-mvc