Invalid Cast - Chart.CartesianGridLineAnnotation

4 posts, 0 answers
  1. MiKo
    MiKo avatar
    2 posts
    Member since:
    Oct 2014

    Posted 22 Aug Link to this post

    Hi,

    I've tried to use the chart annotations exactly as described in this example. Unfortunately, creating the annotations and adding them to the chart from the code behind does not work. When doing so, an exception happens:

    An exception of type 'System.InvalidCastException' occurred in System.Private.CoreLib.dll but was not handled in user code
    Unable to cast object of type 'Telerik.XamarinForms.Chart.CartesianGridLineAnnotation' to type 'Telerik.XamarinForms.Chart.ChartSeries'.

     

    As soon as I declare the annotations in XAML, it just works fine. As we need the possibility to adapt the annotations in the code behind, any support would be appreciated. 

  2. Didi
    Admin
    Didi avatar
    250 posts

    Posted 22 Aug Link to this post

    Hello Michael,

    Thank you for the provided details.

    I have noticed that the example link you have send is outdated. It refers to the previous UI of the documentation. I can assure you that this will be fixed. The Chart Annotations article was reviewed and updated. You can check it at the link below:

    https://docs.telerik.com/devtools/xamarin/controls/chart/chart-annotations

    Regarding to the Invalid cast exception, I have created a sample and I could not reproduced the issue on my side. Please find my test project attached. Download it and give it a try.

    If the issue still observes I would like to ask you to modify the attached project regarding your setup and send it back to me? In this way we could research the case further. Note that you should open a support ticket and attach the file there because in the forum only image attachments are allowed.

    I hope I was helpful.

    Regards,
    Didi
    Progress Telerik
    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 Feedback Portal and vote to affect the priority of the items
  3. MiKo
    MiKo avatar
    2 posts
    Member since:
    Oct 2014

    Posted 26 Aug Link to this post

    Hi,

    I've adapted the solution you provided to resemble our project. The exception occurs again.

    As I can't upload *.zip files, please download the modified version from

     

  4. Didi
    Admin
    Didi avatar
    250 posts

    Posted 26 Aug Link to this post

    Hello,

    I am sorry to hear that the exception still occurs. 

    Yes, in the forum only image attachments are allowed, so I would like to ask you not to send projects in the forum in such a way. If you need to send us a project for review, please open a support ticket and attach it there. 

    Thank you for the understanding.

    Regards,
    Didi
    Progress Telerik
    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 Feedback Portal and vote to affect the priority of the items
Back to Top