Multiple C1Charts do not load, MVVM, TabControl, DataTemplate

Posted by: wkelly1 on 8 August 2018, 11:10 pm EST

    • Post Options:
    • Link

    Posted 8 August 2018, 11:10 pm EST

    In my real project, I have C1Charts that are not loading properly. I was able to recreate the issue with a simple demo. The demo is attached. The demo has these important elements:

    • “MVVM”

    • “DataTemplates”

    • “TabControl with C1Charts on different tabs”

    To see the problem:

    • “Run the demo”

    • “Click on the Chart 1 tab, see the chart”

    • “Click on the Chart 2 tab, notice that the chart does not change, though the TextBlock text does change”

    • “Close the demo”

    • “Restart the demo”

    • “Click on the Chart 2 tab, see the chart”

    • “Click on the Chart 1 tab, notice that the chart does not change, though the TextBlock text does change”

    To me, it seems important the TextBlock is updating properly, while the chart is not.

    Am I doing something wrong? Or is there a work around?

    Demo.zip

  • Posted 9 August 2018, 5:45 am EST

    Hello,

    It seems that on changing the tabs the DataContext changes are not being notified for the SeriesItemsSource. As a workaround, you can explicitly set the NotifyOnTargetUpdated to True for the ChartData DataContext as shown below:

    <c1:ChartData DataContext="{Binding NotifyOnTargetUpdated=True}" SeriesItemsSource="{Binding Curves}">
    

    Hope it helps.

    Regards,

    Basant

  • Posted 9 August 2018, 4:20 pm EST

    Well done. That fixed both the demo and my real app. Thank you!

Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels