LegendItem Background-binding

Sep 23, 2009 at 10:24 AM

Hello everybody,

can somebody explain me, how the background of the little rectangle of one legenditem is applied?

When I use the chart-control in a normal WPF-Window, it works correctly.
When I use the chart-control in a library and render it with RenderTargetBitmap, it renders everything correctly, except the background of the little box beside the legend item (Rectangle).
There is no background or stroke visible of the rectangle, it seems to be a binding problem, but why?

I call Mesaure, Arrange and finally UpdateLayout, but for this problem, it doesn't work.

This is the XAML code for the LegendItem:

    <Style TargetType="charting:LegendItem">
        <Setter Property="IsTabStop" Value="False" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="charting:LegendItem">
                    <StackPanel Orientation="Horizontal">
                        <Rectangle Width="8" Height="8" Fill="{Binding Background}" Stroke="{Binding BorderBrush}" StrokeThickness="1" Margin="0,0,3,0" />
                        <datavis:Title Content="{TemplateBinding Content}" />
                    </StackPanel>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

The TemplateBinding Content works, but the other Binding Background and BorderBrush doesn't work with RenderTargetBitmap.

Any idea why it is not rendered?

Please help me! I already spent 8 hours to this problem!!!
Tell me, if you need some code.

Thanks you.