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

SfCarousel and datatemplateselector not working

Thread ID:

Created:

Updated:

Platform:

Replies:

144684 May 17,2019 11:10 AM UTC May 21,2019 07:38 AM UTC Xamarin.Forms 3
loading
Tags: SfCarousel
Jørgen
Asked On May 17, 2019 11:10 AM UTC

I have a data template selector with two data templates and set the key of the datatemplateselector as ItemTemplate on SfCarousel.

Result:
Invalid Operation Exception: LoadTemplate should not be null


Source:

        <sfc:SfCarousel x:Name="carousel"
                ItemTemplate="{StaticResource 
mediaDataTemplateSelector}"
                ItemsSource="{Binding MediaFiles}
                HorizontalOptions="FillAndExpand" VerticalOptions="FillAndExpand" /> 
  


  <ResourceDictionary>
            <DataTemplate x:Key="mediaImageTemplate">
            </DataTemplate>
            <DataTemplate x:Key="mediaVideoTemplate">
            </DataTemplate>
            <local:MediaDataTemplateSelector x:Key="mediaDataTemplateSelector"
                ImageTemplate="{StaticResource mediaImageTemplate}"
                VideoTemplate="{StaticResource mediaVideoTemplate}" />
            
        </ResourceDictionary>
    </ContentPage.Resources>
  

Muneesh Kumar G [Syncfusion]
Replied On May 20, 2019 12:41 PM UTC

Hi Jørgen, 
 
We have checked your requirement from our side and in our current implementation, we currently do not have "DataTemplateSelector Support for SfCarousel". We have logged a feature report for the same. You can find the feedback link details from below.  
 
   
If you have any more specification/suggestions to the feature request, you can add it as a comment in the portal.  
 
And the feature will be available in Volume 3 Release, which will be available on month of September 2019. Please let us know if you have any concern. 
 
Regards, 
Muneesh Kumar G.  


Jørgen
Replied On May 20, 2019 02:15 PM UTC

Thanks! That would work. Just thinking about an 'infinite' scrolling carousel when there are >2 items.

Muneesh Kumar G [Syncfusion]
Replied On May 21, 2019 07:38 AM UTC

Hi Jørgen, 
 
Thanks for your update, we have analyzed your requirement and it can be achieved using UIVirtualization support as per the below code snippet.  
 
Code snippet 
<carousel:SfCarousel x:Name="carousel" ItemTemplate="{StaticResource itemTemplate}" ItemsSource="{Binding ImageCollection}" 
 ItemHeight="200" ItemWidth="200" ItemSpacing="2" 
 EnableVirtualization="True" 
 ViewMode="Linear"> </carousel:SfCarousel> 
 
We have prepared a sample based on your requirement. Please have the sample and the UG link for the reference.

Sample : http://www.syncfusion.com/downloads/support/directtrac/general/ze/UIVirtualization928560266
 
 
Regards, 
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