Charting: LineSeries DataPointStyle Issue

Feb 26, 2010 at 10:36 AM


I try to style a LineSeries.

First a try to style the LineDataPoints of the LineSeries.

The Style is quite simple - it just binds the Background Property to the Color Property of my custom data object.

<Style x:Key="lineDataPointStyle" TargetType="{x:Type chartingToolkit:LineDataPoint}" >
        <Setter Property="Background" Value="{Binding Color}" />

That kind of works fine - the DataPoints have the desired color - but evenso I always get one debug message:

System.Windows.Data Error: 39 : BindingExpression path error: 'Color' property not found on 'object' ''DiagramVM' (HashCode=31910704)'. BindingExpression:Path=Color; DataItem='DiagramVM' (HashCode=31910704); target element is 'LineDataPoint' (Name=''); target property is 'Background' (type 'Brush')

DiagramVM is my ViewModel for the entire chart - which Wpf uses because of the visual inheritance of dependency properties... but where is this mysterious LineDataPoint without correct DataContext?

Okay now the real problem - the Polyline of the LineChart is not showing anymore even if I set a PolylineStyle in the LineSeries.

Why is that happening and is there a way to fix this behaviour?