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

LoadTemplate should not be null

I am getting the error mentioned above when I try to implement a data template selector on the sfRotator control. 

Running on Visual Studio Enterprise 2019
Syncfusion control version 17.1.0.47

        <ResourceDictionary>

            <DataTemplate x:Key="SampleTemplateTextLine">
                <ViewCell>
                    <local:TextLine
                        HorizontalOptions="FillAndExpand"
                        Columns="{Binding Columns}" />
                </ViewCell>
            </DataTemplate>

            <DataTemplate x:Key="SampleTemplateEmptyLine">
                <ViewCell>
                    <BoxView
                        BackgroundColor="Transparent"
                        HorizontalOptions="FillAndExpand"
                        HeightRequest="10"/>
                </ViewCell>
            </DataTemplate>

            <local:SampleTemplateSelector x:Key="SampleTemplateSelector"
                SampleTemplateTextLine="{StaticResource SampleTemplateTextLine}"
                SampleTemplateEmptyLine="{StaticResource SampleTemplateEmptyLine}" />
        </ResourceDictionary>

            <sfRotator:SfRotator
                HorizontalOptions="FillAndExpand"
                VerticalOptions="FillAndExpand"
                NavigationStripMode="Dots"
                NavigationDirection="Horizontal"
                ItemsSource="{Binding SampleList}"
                ItemTemplate="{StaticResource SampleTemplateSelector}">
            </sfRotator:SfRotator>

3 Replies

MK Muneesh Kumar G Syncfusion Team July 4, 2019 06:03 AM UTC

Hi Liam, 
 
Greetings from Syncfusion.  
 
We have analyzed your query and we would like to inform you that this problem has been fixed in our latest Vol 2 Beta release (17.2.0.28). Please upgrade our version to resolve this problem.  
 
Before update to Beta version, please follow steps mentioned in below link to clear old nuget cache.   
  
 
Regards, 
Muneesh Kumar G.    



LK Liam Keogh July 4, 2019 09:44 AM UTC

Hi Muneesh, unfortunately updating to version 17.2.28-beta introduces a NullReferenceException.

UNHANDLED EXCEPTION:
System.NullReferenceException: Object reference not set to an instance of an object.
at Syncfusion.SfRotator.XForms.Droid.SfRotatorRenderer.GetViewTemplateFromTemplate (Xamarin.Forms.DataTemplate template, System.Int32 index, Xamarin.Forms.Rectangle size, Syncfusion.SfRotator.XForms.SfRotator _rotator)

Can you confirm if this has anything to do with my Xamarin.Forms version or not?



MK Muneesh Kumar G Syncfusion Team July 4, 2019 10:22 AM UTC

Hi Liam,  
 
We have analyzed your code snippet and we found that the reported problem occurs due to using the ViewCell in DataTemplate.  
 
You can resolve this problem by using TextLine directly without ViewCell in DataTemplate.  
  
Regards,  
Muneesh Kumar G.  


Loader.
Up arrow icon