SciChart® the market leader in Fast WPF Charts, WPF 3D Charts, iOS Chart, Android Chart and JavaScript Chart Components


I have two similar charts, the first one is rendered in the View and it is working fine, but the other one is rendered in the memory at run time. The both charts share the same RenderableSeries, but when I assign the RenderableSeries to the SciChartSurface Instance at run time then I get the following error message:

Cannot implicitly convert type ‘System.Collections.ObjectModel.ObservableCollection(SciChart.Charting.Model.ChartSeries.ImpulseRenderableSeriesViewModel)’ to ‘System.Collections.ObjectModel.ObservableCollection(SciChart.Charting.Visuals.RenderableSeries.IRenderableSeries)’

I already changed the Data Type of the renderable Series to FastImpulseRenderableSeries but the behavior in the View is not the same.

I am trying to cast each serie but it does not work. do you habe a hint for me?

  • You must to post comments

Hi there,

You cannot cast IRenderableSeriesViewModel to IRenderableSeries – they are different types (please see our Class Hierarchy, you can see what inherits what).

Instead, you need to convert RenderableSeriesViewModels to RenderableSeries. The way we do this in WPF is via the SeriesBinding MarkupExtension:

<!-- VIEW-->

<!-- Declare a SciChartSurface with SeriesBinding -->
<!-- Where xmlns:s=" -->
<s:SciChartSurface RenderableSeries="{s:SeriesBinding RenderableSeriesViewModels}">

   <!-- XAxis, YAxis omitted for brevity -->


// Viewmodel
private ObservableCollection<IRenderableSeriesViewModel> _renderSeriesViewModels;
public ObservableCollection<IRenderableSeriesViewModel> RenderableSeriesViewModels
   get { return _renderSeriesViewModels; }
      _renderSeriesViewModels = value;

The equivalent in C# code only is to use a converter, e.g.

List<IRenderableSeriesViewModel> rSeriesViewModels = ... // populate your view models
var sciChartSurface = new SciChartSurface();
sciChartSurface.RenderableSeries = new RenderableSeriesSourceCollection(rSeriesViewModels);

Best regards,

  • You must to post comments

Thanks a lot. It works perfectly now.

  • You must to post comments
Showing 2 results
Your Answer

Please first to submit.