Can't change Chart LineSeries Line color

Jan 10, 2012 at 11:02 AM

I'm trying dynamically change LineSeries color. In application resource section set Style for LineDataPoint:

	<Style x:Key="DataPointStyle" TargetType="chartingToolkit:LineDataPoint">
            <Setter Property="Background" Value="#0077CC" />
            <Setter Property="BorderBrush" Value="White"/>
            <Setter Property="BorderThickness" Value="2"/>
            <Setter Property="IsTabStop" Value="False"/>
            <Setter Property="Template">
                    <ControlTemplate TargetType="chartingToolkit:LineDataPoint">
                        <Grid x:Name="Root" Opacity="1">
                            <Ellipse StrokeThickness="{TemplateBinding BorderThickness}" Stroke="{TemplateBinding BorderBrush}" Fill="{TemplateBinding Background}"/>

and in code behind *.css on some event change color like:

	    Style originalStyle = Application.Current.Resources["DataPointStyle"] as Style;
	    Color color = GetColor();
            var dpStyle = new Style() { BasedOn = originalStyle };
            dpStyle.TargetType = typeof(LineDataPoint);
            dpStyle.Setters.Add(new Setter(LineSeries.BackgroundProperty, new SolidColorBrush(color)));
            lSeries.DataPointStyle = dpStyle;

first time when I'm adding lSeries, color applied correctly, but when I'm changing color already created line series, only color of line point's changing (I'm applying color same way).

What I'm doing wrong and how can I change lines and points color dynamically?