This is a migrated thread and some comments may be shown as answers.

RadChart with Bar not Calling Item Style Delegate

1 Answer 59 Views
This is a migrated thread and some comments may be shown as answers.
Top achievements
Rank 1
Jeremy asked on 10 Jun 2010, 03:46 PM
I'm trying to style a stacked bar panel and running into some problems. The definition of the panel looks like this:

            ItemsSource="{Binding StatusCounts}">   
                        <Charting:ChartLegend Visibility="Collapsed"/>  
                        <Charting:Bar3DSeriesDefinition ShowItemLabels="True"/>  
                        <Charting:ItemMapping FieldName="Count" DataPointMember="YValue"/>  
                        <Charting:ItemMapping FieldName="StatusDescription" DataPointMember="XCategory"/>  

The StatusCounts is a IEnumerable<T> where T is an object that has the Count and StatusDescription fields. In the code behind, I do this:

public StatusChartControl()  
            StatusChart.CreateItemStyleDelegate = CreateItemStyle;  

And then:

public Style CreateItemStyle(Control control, Style baseStyle, DataPoint dataPoint, DataSeries dataSeries)  
    if (control is ChartLegendItem || dataPoint == null)  
        return baseStyle;  
    // Create a new style, do not use the one that is provided as parameter.  
    var newStyle = new Style(baseStyle.TargetType) {BasedOn = baseStyle};  
    var brush = ((StatusCount) dataPoint.DataItem).Region.AsBrush();  
    if (control is BaseChartItem2D)  
        newStyle.Setters.Add(new Setter(Shape.FillProperty, brush));  
    if (control is SeriesItemLabel)  
        newStyle.Setters.Add(new Setter(SeriesItemLabel.FillProperty, brush));  
    return newStyle;  

The problem is ... the create item style is never called! I set a breakpoint and it never fires. The chart is rendering fine, I see axis labels and lables on the items, etc, but I never get the create item style delegate to fire so I can colorize the data items. Help!

1 Answer, 1 is accepted

Sort by
Telerik team
answered on 15 Jun 2010, 02:42 PM
Hello Jeremy,

The 3D chart does not support styling as this mechanism is available only for regular WPF/Silverlight controls (i.e. 2D scenarios).

We plan on refactoring the whole WPF/Silverlight 3D chart in order to bring it to parity with the 2D chart.

the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
Asked by
Top achievements
Rank 1
Answers by
Telerik team
Share this question