We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

Databinding Complex Itemssource

Hello,

I'm trying to bind a complex datasource to a line series chart without any luck.

The itemssource is structured as follows:

Root
|
-CollectedValues-values[]
|
...
|
-TimeStamp-timestamps[]
|
...

My XAML looks like this:

<chart:LineSeries XBindingPath="CollectedValues.values"
	          YBindingPath="TimeStamp.timeStamps"
ItemsSource
="{Binding MyDataPath}">
The chart remains empty (the itemssource has the desired content available) and the following error gets logged:

Error: Converter failed to convert value of type 'MyApp.Models.Data+Root, MyApp, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' to type 'IBindableIterable'; BindingExpression: Path='MyDataPath' DataItem='MyApp.ViewModels.MainPageViewModel'; target element is 'Syncfusion.UI.Xaml.Charts.LineSeries' (Name='null'); target property is 'ItemsSource' (type 'IBindableIterable').

How do I properly bind the chart to my itemssource?

Many thanks in advance!

5 Replies

SR Samuel Rajadurai Edwin Rajamanickam Syncfusion Team May 12, 2016 05:46 PM UTC

Hi Marco,

Thanks for contacting Syncfusion Support.

We analyzed your requirement of binding complex data source and prepared samples in "Complex Binding" and "Array Binding". Please find the attached samples from the link below.

Complex Binding: Complex_Binding_Prop
Array Binding: Complex_Binding_Array

For more information please refer the following UG link: 
  
Please let us know if you have any queries.

Regards,
Samuel

 



MD MD May 13, 2016 05:33 AM UTC

Thanks for the samples but it ain't working the error still occurs with my itemssource.

Error: Converter failed to convert value of type 'MyApp.Models.Data+Root, MyApp, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' to type 'IBindableIterable'; BindingExpression: Path='MyDataPath' DataItem='MyApp.ViewModels.MainPageViewModel'; target element is 'Syncfusion.UI.Xaml.Charts.LineSeries' (Name='null'); target property is 'ItemsSource' (type 'IBindableIterable').


SR Samuel Rajadurai Edwin Rajamanickam Syncfusion Team May 14, 2016 10:06 AM UTC

Hi Marco,

Thanks for the update.

We have modified the complex binding sample to achieve your requirement. Please find the sample from the link below.
Complex_Binding_ProArr 

If this doesn’t satisfy your requirement, please provide us a sample with the use case of your scenario, it would be more helpful for us to provide you the solution. 

Regards,
Samuel



MD MD May 18, 2016 10:25 AM UTC

This didn't work either. It seems that the control can't handle nested itemssources. I've made a new nested list in a fresh app and the same error occured.

I worked around it by making a flat itemssource.

Thanks anyway.


SR Samuel Rajadurai Edwin Rajamanickam Syncfusion Team May 19, 2016 02:39 PM UTC

Hi Marco,

Thanks for the update.

SfChart having provision to bind complex properties in chart series. IEnumerable types (Array, IList etc.,) can be bind only in the ItemsSource property and in XBindingPath and YBindingPath properties, we can bind only primitive datatype properties.

Regards,
Samuel 


Loader.
Live Chat Icon For mobile
Up arrow icon