Clearing databound collection causes cast error

4 posts, 0 answers
  1. Rav
    Rav avatar
    36 posts
    Member since:
    Nov 2011

    Posted 28 Mar 2010 Link to this post

    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:

    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?

  2. Giuseppe
    Giuseppe avatar
    2363 posts

    Posted 29 Mar 2010 Link to this post

    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,
    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.
  3. Rav
    Rav avatar
    36 posts
    Member since:
    Nov 2011

    Posted 29 Mar 2010 Link to this post

    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">  
                    <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">  
                        <GradientStop Color="#FF87D200" Offset="0"/>  
                        <GradientStop Color="#FF4FA600" Offset="1"/>  
  4. jackd doh
    jackd doh avatar
    2 posts
    Member since:
    Sep 2009

    Posted 30 Mar 2010 Link to this post

    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.
Back to Top