I want to change the background color of AxisX label. I had seen some forums to change the text alignment. But I want to change background color (something like telerik PITS dashboard - Activity). How do I achieve that?
Changing the labels background is not supported out of the box. In order to achieve that, additional retemplating needs to be done.
I've attached a sample project that you could refer to and see how I did it.
If you simply want to change the labels' foreground only, it can be done easily by creating a new style like this: </UserControl.Resources>
<Style x:Key="LabelForeground" TargetType="TextBlock">
<Setter Property="Foreground" Value="Red" />
</Style>
</UserControl.Resources>
and then show in your code behind what style should be used: lineChart.DefaultView.ChartArea.AxisX.AxisStyles.ItemLabelStyle = this.Resources["ItemLabelStyle"] as Style;
In case you haven't visited our Styes and Templates help topics, they can be found here.
Best wishes,
Peshito
the Telerik team
Register for the Q2 2011 What's New Webinar Week. Mark your calendar for the week starting July 18th and book your seat for a walk through of all the exciting stuff we will ship with the new release!