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

Clearing databound collection causes cast error

3 Answers 26 Views
Chart
This is a migrated thread and some comments may be shown as answers.
Rav
Top achievements
Rank 2
Rav asked on 29 Mar 2010, 03:27 AM
Hi Telerik,

I've recently upgraded to Q1 2010. In my code I have had a radchart bound to an observablecollection. The first display of the chart works fine, however when I use either collection.Clear() or ItemsSource = null I receive the following error:

InvalidCastException  
Unable to cast object of type 'System.Windows.Style' to type 'System.Collections.Generic.IList'1[System.Windows.Style] 

This occurs when using a BarSeriesDefinition, however when I use a LineSeriesDefinition it works fine. Also, this used to work previously in both SeriesDefinitions.

Any Ideas?

Rav

3 Answers, 1 is accepted

Sort by
0
Giuseppe
Telerik team
answered on 29 Mar 2010, 12:10 PM
Hello Rav,

Unfortunately we are unable to reproduce the problematic behavior in our local tests. Please review the attached sample application and let us know how can we observe the erroneous issue so we can advise you how to proceed.

Looking forward to your reply.


Best wishes,
Freddie
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.
0
Rav
Top achievements
Rank 2
answered on 30 Mar 2010, 02:20 AM
I had the followin Style in my dictionary.xaml. Removing it fixed the error:

<Style x:Key="BarStyle" TargetType="{x:Type Shape}">  
        <Setter Property="Fill">  
            <Setter.Value> 
                <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">  
                    <GradientStop Color="#FF87D200" Offset="0"/>  
                    <GradientStop Color="#FF4FA600" Offset="1"/>  
                </LinearGradientBrush> 
            </Setter.Value> 
        </Setter> 
    </Style> 
0
jackd doh
Top achievements
Rank 1
answered on 30 Mar 2010, 02:28 PM
I second this. But in my case it was a (specified inside UserControl.Resources) style targeting Bar Class. It's weird because the style resource is never referenced explicitly anywhere, and it has a key, which I assumed would not make it apply to all Bar classes in the UserControl.
Tags
Chart
Asked by
Rav
Top achievements
Rank 2
Answers by
Giuseppe
Telerik team
Rav
Top achievements
Rank 2
jackd doh
Top achievements
Rank 1
Share this question
or