I have been trying to use the CustomGridLines feature to highlight a particular date, what I'd like to do is add a label next to the line, explaining what it's highlighting. Is this possible at all?
Thanks
1 Answer, 1 is accepted
0
Evgenia
Telerik team
answered on 06 Dec 2010, 01:51 PM
Hello Alexis,
It is possible to add Label for your Custom Gridline by retemplating the CustomGridLine. Put this code snippet between UserControl.Resources opening and closing tags:
A grid layout wrapper is addded containing a TextBlock together with the Line that actually displays the custom gridline ( I've marked the new things added to the default template with yellow).
In code behind you need to add CustomGridLine's new styletogether with a string for a DataContext. This string is bound to Text property of TextBlock:
RadChart1.DefaultView.ChartArea.Annotations.Add(
new CustomGridLine()
{
Margin = new Thickness(5,90,0,0),
YIntercept = 90,
Stroke = new SolidColorBrush(Colors.Purple),
StrokeThickness = 2,
Style = this.Resources["CustomGridLineStyle"] as Style,
DataContext = "My custom text",
});
Have in mind that with this approach you will be able to locate the Label of the CustomGridLine by applying Margin to it as shown above.
Kind regards,
Evgenia
the Telerik team
Browse the videos here>> to help you get started with RadControls for Silverlight