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

Binding to Lists of Lists in XAML

If I have a list of lists object, let's call it MovieCatalogue, and in that list of lists I have a collection of lists that contain Movies that relate to the same genre. 

I want to be able to set the ItemSource of the Rotator to the MovieCatalogue object and then have each page show a ListView of all movies contained within the lists of the object. For example, page one of the rotator would show me all entries of the HorrorList, page two would show all entries of ComedyList and so on.. 

As a bonus, each entry would need to be bound to the title of the movie that is stored in the list. Attached is my current implementation, but it returns an invalid cast exception.

Attachment: movielistrotator_f5b39938.zip

3 Replies

MK Muneesh Kumar G Syncfusion Team July 6, 2019 11:22 AM UTC

Hi Liam, 
Greetings from Syncfusion.  
We have validated your query and your code snippet, to resolve the reported issue you have to add the ViewCell before the label in listview as like below code snippet. 
<rotator:SfRotator  x:Name="ImageRotator"  ItemsSource="{Binding ImageCollection}" DotsBorderColor="Red"   HorizontalOptions="FillAndExpand" 
                 <ListView  ItemsSource="{Binding ImageList}">
                                    <Label Text ="{Binding Title}"/>

We have created a sample for this. Please find the sample from the following location.
Sample Link: 
We request you to try our sample if your requirement is different from this, can you please share more detail information about your requirement. 
This will be helpful for us to provide you a good solution and improve us to serve you better. 
Muneesh Kumar G.   

LK Liam Keogh July 8, 2019 08:28 AM UTC

This was exactly what I was looking for, thank you.

MK Muneesh Kumar G Syncfusion Team July 8, 2019 09:01 AM UTC

Hi Liam,   
Thanks for the update. 
We are glad to know that the given solution works. Please let us know if you need any further assistance. 
Muneesh Kumar G. 

Live Chat Icon For mobile
Up arrow icon