- Home
- Forum
- Xamarin.Forms
- SfCarousel and datatemplateselector not working
SfCarousel and datatemplateselector not working
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" />
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>
</DataTemplate>
<DataTemplate x:Key="mediaVideoTemplate">
</DataTemplate>
<local:MediaDataTemplateSelector x:Key="mediaDataTemplateSelector"
ImageTemplate="{StaticResource mediaImageTemplate}"
VideoTemplate="{StaticResource mediaVideoTemplate}" />
</ResourceDictionary>
</ContentPage.Resources>
SIGN IN To post a reply.
3 Replies
MK
Muneesh Kumar G
Syncfusion Team
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Ø
Jørgen
May 20, 2019 02:15 PM UTC
Thanks! That would work. Just thinking about an 'infinite' scrolling carousel when there are >2 items.
MK
Muneesh Kumar G
Syncfusion Team
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
Sample : http://www.syncfusion.com/downloads/support/directtrac/general/ze/UIVirtualization928560266
Regards,
Muneesh Kumar G.
SIGN IN To post a reply.
- 3 Replies
- 2 Participants
-
JØ Jørgen
- May 17, 2019 11:10 AM UTC
- May 21, 2019 07:38 AM UTC