Edit this page


The RadLegend control exposes an ItemTemplate property which you can use to change the default ItemTemplate. The DataContext of the template is a LegendItem object.

Note that a GeometryCloneConverter is used in the Path.Data Binding. This is to work around a limitation in the Silverlight framework, where an exception is thrown when a static resource is used to set the Data property of a Path.

A simple demonstration how to use the ItemTemplate property is given below:

<telerik:RadLegend HorizontalAlignment="Center" UseLayoutRounding="True">
            <Border Background="{Binding MarkerFill}" BorderThickness="1" BorderBrush="{Binding MarkerStroke}">
                    <TextBlock Text="{Binding Title}" Foreground="White" Margin="15 0 0 0" />
                    <Path Width="12" 
                            <Binding Path="ActualMarkerGeometry"
                                 RelativeSource="{RelativeSource AncestorType=telerik:LegendItemControl}">
                                    <telerik:GeometryCloneConverter />
            <telerik:LegendItem MarkerFill="#FF55AA33" MarkerStroke="Black" Title="Legend item 1" />
            <telerik:LegendItem MarkerFill="#FFCC3399" MarkerStroke="Black" Title="Legend item 2" />
            <telerik:LegendItem MarkerFill="#FF5511BB" MarkerStroke="Black" Title="Legend item 3" />

And here is the end result:

Is this article helpful? Yes / No
Thank you for your feedback!

Give article feedback

Tell us how we can improve this article