Data binding error to PieChart

3 posts, 1 answers
  1. Doug
    Doug avatar
    15 posts
    Member since:
    Feb 2011

    Posted 18 Jul 2012 Link to this post


    I'm using version 2012.2.607.1050.

    I have a data bound piechart with checkbox next to it. When i click the checkbox I then change the ItemSource collection. I have discovered that if the new collection has fewer points than the old collection i get an exception.

       at System.ThrowHelper.ThrowArgumentOutOfRangeException()
       at System.Collections.Generic.List`1.get_Item(Int32 index)
       at System.Collections.ObjectModel.Collection`1.get_Item(Int32 index)
       at Telerik.Windows.Controls.ChartView.ChartPalette.GetEntry(String family, Int32 index)
       at Telerik.Windows.Controls.ChartView.PieSeries.ApplyPaletteCore()
       at Telerik.Windows.Controls.ChartView.PresenterBase.ApplyPalette()
       at Telerik.Windows.Controls.ChartView.PresenterBase.UpdateUI(ChartLayoutContext context)
       at Telerik.Windows.Controls.ChartView.RadChartBase.UpdateUICore(ChartLayoutContext context)
       at Telerik.Windows.Controls.ChartView.PresenterBase.UpdateUI(ChartLayoutContext context)
       at Telerik.Windows.Controls.ChartView.RadChartBase.CallUpdateUI()
       at Telerik.Windows.Controls.ChartView.RadChartBase.OnInvalidated()

    The xaml looks like this

       <telerik:RadPieChart Grid.Row="1" x:Name="FolderVersionsPieChart" Palette="Metro" >
                        <telerik:PieSeries ShowLabels="True" ItemsSource="{Binding VersionData}" >
                                <telerik:ChartSeriesLabelDefinition Margin="-8,0,0,0">
                                        <telerik:PropertyNameDataPointBinding PropertyName="Label" />
                                <telerik:PropertyNameDataPointBinding PropertyName="Value" />

    In the view model the collection is changed by setting new VersionData in the following method

     public ObservableCollection<DataPoint> VersionData
                get { return _versionData; }
                    _versionData = value;

    The DataPoint class a simple string, value class

    public class DataPoint
            private double _value;
            private string _label;

            public double Value
                get { return _value; }
                set { _value = value; }

            public string Label
                get { return _label; }
                set { _label = value; }

    The only way I can get around this error is to populate the new collection with dummy zero DataPoint object values if the new collection has fewer DataPoint objects than the old collection. Then the new collection size will be the same size as the old one or larger. A bit ugly to say the least.

    Am I doing something wrong here or is there another less hacky work around to fix this?

    Thanks for your help
  2. Answer
    Rosko avatar
    137 posts

    Posted 20 Jul 2012 Link to this post

    Hi Doug,

    This is a known bug. The fix will be available for the next service pack release which is scheduled in one week.

    All the best,
    the Telerik team

    Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

  3. DevCraft R3 2016 release webinar banner
  4. Doug
    Doug avatar
    15 posts
    Member since:
    Feb 2011

    Posted 20 Jul 2012 Link to this post

    Thanks Rosko.

Back to Top