WPF Toolkit Chart using ControlTemplate don't show my LineSeries

Nov 20, 2014 at 9:48 AM
I create a customized chart, using the example posted here

My Xaml looks like this:
<chartingToolkit:Chart Name="lineChart" Loaded="lineChart_Loaded">
    <chartingToolkit:Chart.Template>                
        <ControlTemplate TargetType="chartingToolkit:Chart">

            <Border Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" >
                <Grid>

                    <chartingToolkit:LineSeries x:Name="LineSeries"/>


                    <chartingprimitives:EdgePanel x:Name="ChartArea" Style="{TemplateBinding ChartAreaStyle}" Margin="10,30,10,10">
                        <Grid Canvas.ZIndex="-1" Style="{TemplateBinding PlotAreaStyle}" />
                        <Border Canvas.ZIndex="10" BorderBrush="#FF919191" BorderThickness="1" Background="White"/>
                    </chartingprimitives:EdgePanel>

                    <datavis:Legend x:Name="Legend" Title="{TemplateBinding LegendTitle}" Style="{TemplateBinding LegendStyle}" Background="#FFF8DC"
                                        VerticalAlignment="Top" HorizontalAlignment="Right" Margin="0,30,15,0" />


                    <Border Background="#FFF8DC" BorderBrush="Black" BorderThickness="0.5" CornerRadius="5,5,5,5"
                            VerticalAlignment="Top" HorizontalAlignment="Right" Margin="0,0,10,0" Width="200">
                        <Label x:Name="LABLE_Description" />
                    </Border>
                </Grid>
            </Border>

        </ControlTemplate>
    </chartingToolkit:Chart.Template>


</chartingToolkit:Chart>
On Chart_Loaded event I inserted the code:
List<KeyValuePair<string, int>> valueList = new List<KeyValuePair<string, int>>();
    valueList.Add(new KeyValuePair<string, int>("Developer", 6000));
    valueList.Add(new KeyValuePair<string, int>("Misc", 2000));
    valueList.Add(new KeyValuePair<string, int>("Tester", 5000));
    valueList.Add(new KeyValuePair<string, int>("QA", 3000));
    valueList.Add(new KeyValuePair<string, int>("Project Manager", 4000));

    LineSeries lineSeries = new LineSeries();
    lineSeries.DependentValuePath = "Value";
    lineSeries.IndependentValuePath = "Key";
    lineSeries.IsSelectionEnabled = true;
    lineSeries.ItemsSource = valueList;
    lineChart.Series.Add(lineSeries);
But when I run the application I see an empty chart eare... Can anyone tell me what I'm doing wrong?