Hi, I'm using a RadLegend, which is bound to a LegendItemCollection on my view model.
When I update the legend by regenerating the LegendItemCollection, I notice that the items render very briefly as "Telerik.Windows.Controls.Legend.LegendItem" before the item template is applied.
This is pretty annoying as it happens whenever the legend is updated, which is quite frequent for my current scenario.
I've looked at the default XAML and I think I've found the problem inside the RadLegend control template:
<
ItemsControl
ItemsPanel
=
"{TemplateBinding ItemsPanel}"
ItemsSource
=
"{TemplateBinding Items}"
>
<
ItemsControl.ItemTemplate
>
<
DataTemplate
>
<
legend:LegendItemControl
Content
=
"{Binding}"
ContentTemplate
=
"{Binding ItemTemplate, RelativeSource={RelativeSource AncestorType=telerik:RadLegend}}"
IsHovered
=
"{Binding IsHovered, Mode=TwoWay}"
VisualState
=
"{Binding VisualState}"
/>
</
DataTemplate
>
</
ItemsControl.ItemTemplate
>
</
ItemsControl
>
The issue is with the ContentTemplate binding - if I set ContentTemplate to a static resource instead, then the rendering glitch goes away completely. There is obviously a small execution delay required for the binding to update as it has to search the visual tree, whereas the content binding is applied immediately as the data context is already known.
I can work around this for now by modifying the control template and using a static resource.
It would be great if you could fix this within the control implementation though.
Thanks!
Sam