chaosifier / TabView

TabView control for Xamarin.Forms.
MIT License
124 stars 32 forks source link

problem after upgrading from xamarin.forms 3.6 to 4.0 #29

Closed alkharashiam closed 4 years ago

alkharashiam commented 5 years ago

Hi , I have this tab view working fine in my project Xamarin Version 3.6 , But after upgrading my project to 4 the tab works fine but crashes when I click the first tab item . I can navigate through all tabs normally with no errors except when I return to the first tab with this error

Update : now the crash is on any tab

System.InvalidCastException: Specified cast is not valid.

chaosifier commented 4 years ago

Are you sure the issue is with the TabView control? Maybe the problem actually lies in the content. It would be easier to solve the issue if you could share some code.

Skorska commented 4 years ago

Same issue with last version of xamarin forms `

Grimreaper-ace commented 4 years ago

I am also having the same issue I just started a new clean project. Added the nuget package. Initialized the carousel view. Copied the Xaml from your sample project in to the project

`<?xml version="1.0" encoding="utf-8" ?> <ContentPage xmlns="http://xamarin.com/schemas/2014/forms" xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" xmlns:d="http://xamarin.com/schemas/2014/forms/design" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" mc:Ignorable="d" x:Class="App1.Views.ItemsPage" Title="{Binding Title}" x:Name="BrowseItemsPage" xmlns:tvs="clr-namespace:Xam.Plugin.TabView;assembly=Xam.Plugin.TabView">

<ContentPage.ToolbarItems>
    <ToolbarItem Text="Add" Clicked="AddItem_Clicked" />
</ContentPage.ToolbarItems>

<RefreshView IsRefreshing="{Binding IsBusy, Mode=TwoWay}" Command="{Binding LoadItemsCommand}">
    <StackLayout>
    <tvs:TabViewControl>
        <tvs:TabViewControl.ItemSource>
            <tvs:TabItem HeaderText="First Tab">
                <Button Text="Go back to main page from first page" />
            </tvs:TabItem>
            <tvs:TabItem HeaderText="Second Tab">
                    <Button Text="Go back to main page from second page" />
            </tvs:TabItem>
            <tvs:TabItem HeaderText="Third Tab">
                <Button Text="Go back to main page from third page" />
            </tvs:TabItem>
            <tvs:TabItem HeaderText="Fourth Tab">
                <Button Text="Go back to main page from third page" />
            </tvs:TabItem>
            <tvs:TabItem HeaderText="Fifth Tab">
                <Button Text="Go back to main page from third page" />
            </tvs:TabItem>
            <tvs:TabItem HeaderText="Sixth Tab">
                <Button Text="Go back to main page from third page" />
            </tvs:TabItem>
            </tvs:TabViewControl.ItemSource>
    </tvs:TabViewControl>

    <CollectionView x:Name="ItemsCollectionView"
            ItemsSource="{Binding Items}">
        <d:CollectionView.ItemsSource>
            <x:Array Type="{x:Type x:String}">
                <x:String>First Item</x:String>
                <x:String>Second Item</x:String>
                <x:String>Third Item</x:String>
                <x:String>Fourth Item</x:String>
                <x:String>Fifth Item</x:String>
                <x:String>Sixth Item</x:String>
            </x:Array>
        </d:CollectionView.ItemsSource>
        <CollectionView.ItemTemplate>
            <DataTemplate>
                <StackLayout Padding="10">
                    <Label Text="{Binding Text}" 
                            d:Text="{Binding .}"
                            LineBreakMode="NoWrap" 
                            Style="{DynamicResource ListItemTextStyle}" 
                            FontSize="16" />
                    <Label Text="{Binding Description}" 
                            d:Text="Item descripton"
                            LineBreakMode="NoWrap"
                            Style="{DynamicResource ListItemDetailTextStyle}"
                            FontSize="13" />
                    <StackLayout.GestureRecognizers>
                        <TapGestureRecognizer NumberOfTapsRequired="1" Tapped="OnItemSelected"></TapGestureRecognizer>
                    </StackLayout.GestureRecognizers>
                </StackLayout>
            </DataTemplate>
        </CollectionView.ItemTemplate>
    </CollectionView>
    </StackLayout>
</RefreshView>

`

chaosifier commented 4 years ago

I've updated the nuget package, it should fix the issue.