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. (Last updated on: June 24, 2019).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Binding to Lists of Lists in XAML

Thread ID:

Created:

Updated:

Platform:

Replies:

145739 Jul 5,2019 01:34 PM UTC Jul 8,2019 09:01 AM UTC Xamarin.Forms 3
loading
Tags: SfRotator
Liam Keogh
Asked On July 5, 2019 01:39 PM UTC

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

Muneesh Kumar G [Syncfusion]
Replied On 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" 
            VerticalOptions="FillAndExpand">
            <rotator:SfRotator.ItemTemplate>
                <DataTemplate>
                 <ListView  ItemsSource="{Binding ImageList}">
                    <ListView.ItemTemplate>
                                <DataTemplate>
                               <ViewCell>
                                    <Label Text ="{Binding Title}"/>
                                 </ViewCell>
                                </DataTemplate>
                            </ListView.ItemTemplate>
                    </ListView>
                </DataTemplate>
            </rotator:SfRotator.ItemTemplate>
        </rotator:SfRotator>
 

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. 
 
Regards, 
Muneesh Kumar G.   
 


Liam Keogh
Replied On July 8, 2019 08:28 AM UTC

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


Muneesh Kumar G [Syncfusion]
Replied On 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. 
 
Thanks, 
Muneesh Kumar G. 


CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

Live Chat Icon For mobile
Live Chat Icon