Is it not possible to change the style of the NoDataControlStyle when a theme has been set on the parent chart?
I have a style defined in my UserControl.Resources section of my XAML:
<UserControl.Resources> ... <Style TargetType="telerikCharting:NoDataControl" x:Key="NoDataControlStyle">And then the Metro theme for my chart with the style set on NoDataControlStyle:
<telerikChart:RadChart x:Name="radChart" telerik:StyleManager.Theme="Metro">...<telerikCharting:ChartDefaultView.ChartArea> <telerikCharting:ChartArea NoDataControlStyle="{StaticResource NoDataControlStyle}" IsNoDataMessageEnabled="True" NoDataString="My NoData text" EnableAnimations="False">The end result is always that my NoDataControlStyle has the Metro theme...
I have tried setting the style in code behind as well and it didn't change the behavior.
Thanks!
Chris
5 Answers, 1 is accepted
Thanks!
Chris
Try setting ApplicationTheme in your project before InitializeComponent();
StyleManager.ApplicationTheme = new MetroTheme();Regards,
Evgenia
the Telerik team
That works to help fix the issues with the chart (sets the Metro theme for the chart and uses my custom NoDataControlStyle)! :) It creates a new problem for me though which is that it affects the style of other objects in the application. The chart control is hosted in a RadDock and when I set the StyleManager.ApplicationTheme in the chart control it changes the style of that parent dock control to Metro as well which I don't want.
I read the docs on StyleManager.ApplicationTheme and there seems to be a way to set it on a per control basis:
StyleManager.SetTheme(this.radChart, new MetroTheme());The problem with this though is that I can't do that before InitializeComponent() because I get a nullref trying to apply it to the radChart object. If I do it *AFTER* the InitializeComponent() call I have the same original issue which is that the NoDataControlStyle gets set to Metro as well.
Unfortunately the observed behavior is limitation of our theming mechanism.
An instance theme always should be set after the InitializeComponent() call and an application theme should be set before it. Can you please try to set our Metro theme as application theme and at the same time set the needed one to the RadDock control?
Kind regards,
Sia
the Telerik team