Problem setting style of Chart

Jul 28, 2009 at 4:14 PM

I created a style for my chart to customize the look and feel little.  However, when I set the style on the chart, I lose my custom ColumnDataPoint background colors and the chart uses the default StylePalette.  The simplest sample I can provide uses the "Simple Color Change" example from the demo.  I created a style that simply inherits from the default chart style:

<Style x:Key="MyChartStyle" TargetType="charting:Chart" BasedOn="{StaticResource {x:Type charting:Chart}}" />

Now add it to the Chart:

            Title="Simple Color Change"
            Style="{StaticResource MyChartStyle}">
                DependentValueBinding="{Binding Length}"
                    <Style TargetType="charting:ColumnDataPoint">
                        <Setter Property="Background" Value="Purple"/>

Now the column series no longer uses the Purple defined in the ColumnDataPoint style, it uses the default blue.

Is there something else I need to do so I can specify the style for the chart and the color for the series?

John Myczek


Aug 6, 2009 at 12:41 AM


This is kind of funny - a change I'm working on *at this very minute* fixes the problem you're reporting. :) What's going on is that the Style application on Chart is propagating and the ColumnSeries is claiming the first Style. Then the DataPointStyle of ColumnSeries is applied, but nothing changes because the change isn't propagated correctly (note the lack of a PropertyChanged handler for DataPointStyle in DataPointSingleSeriesWithAxes.cs). What's needed is some code there to push this change out to the DataPoints when it happens.

Incidentally, that's NOT what I'm doing on my machine... :) I'm actually pushing through a Binding so that the DataPoints will *automatically* get the right value from ActualDataPointStyle which I've turned into a DependencyProperty. You could do something like this, too, but it's more work.

Hope this helps - this should be fixed in the next release. I'm hoping to do another Data Visualization Development Release soon, so you should be able to pick that up to get this fix if you can wait a bit.

Thanks for your help!

Aug 6, 2009 at 3:12 PM

Thanks for the update.  I am looking forward to the next release.


Sep 21, 2009 at 5:06 PM

I just got this working with "Development Release 1" (

Thank you,

John Myczek