Unable to convert instance of type 'Android.Widget.TextView' to type 'Android.Support.V7.Widget.Toolbar

I'm relatively new to Xamarin, (6 mos.), and this is my first attempt at incorporating Syncfusion tools. This page is more complex than I've attempted. I've added the SfTabView to a ContentPage that also has a Xamarin ListView that incorporates a DataTemplateSelector.  I see that it's a casting issue, but I'm also guessing that I've structured the page incorrectly. Any thoughts? Thanks!

Here's the error:

System.InvalidCastException: Unable to convert instance of type 'Android.Widget.TextView' to type 'Android.Support.V7.Widget.Toolbar'.

Here's the page structure:

<ContentPage>
     <ContentPage.Resources>
          <ResourceDictionary>
               <DateTemplate x:Key="validTemplate">  
                    <ViewCell>
                         <Grid>
                              ...
                         </Grid>
                    </ViewCell>
               </DateTemplate> 
               <DateTemplate x:Key="invalidTemplate">  
                    <ViewCell>
                         <Grid>
                              ...
                         </Grid>
                    </ViewCell>
               </DateTemplate> 
          </ResourceDictionary>
     </ContentPage.Resources>

     <ContentPage.Content>        
          <StackLayout>
               <tabView:SfTabView />              
               <ListView ItemTemplate="{StaticResource TemplateSelector}" />
          </StackLayout>        
     </ContentPage.Content>       
</ContentPage>


For the  <tabView:SfTabView />  I'm using the sample code from the Syncfusion site:
<tabView:SfTabView >
<tabView:SfTabItem Title="Call">
<tabView:SfTabItem.Content>
	<Grid BackgroundColor="Red" x:Name="AllContactsGrid" />
</tabView:SfTabItem.Content>
</tabView:SfTabItem>
<tabView:SfTabItem Title="Favorites">
<tabView:SfTabItem.Content>
	<Grid BackgroundColor="Green" x:Name="FavoritesGrid" />
</tabView:SfTabItem.Content>
</tabView:SfTabItem>
<tabView:SfTabItem Title="Contacts">
<tabView:SfTabItem.Content>
	<Grid BackgroundColor="Blue" x:Name="ContactsGrid" />
</tabView:SfTabItem.Content>
</tabView:SfTabItem>
</tabView:SfTabView>

2 Replies

JO Joel July 23, 2018 12:26 PM UTC

Please disregard this post. It was indeed a problem with the way I had structured the code. I'm looking forward to seeing Syncfusion Xamarin examples in Git Hub. That will really enhance the learning process. 


PA Paul Anderson S Syncfusion Team July 23, 2018 12:37 PM UTC

Hi Joel, 
 
Thank you for using Syncfusion products. 
 
We are glad that you have achieved your requirement. We have also created a simple sample as per your code snippet and can be downloaded in the below link. 
 
 
Thank you for your suggestions on Exposing our Syncfusion samples in Github. We will consider your request in our future releases. Currently we are shipping our samples with our Syncfusion Xamarin bundle which can be downloaded from our Website. 
 
Regards, 
Paul Anderson 


Loader.
Up arrow icon