Search code examples
android.nettabsmaui

Sharpnado Tabs First Tab is not showing


I am using DelayedViews in my TabSwitcher. When i am changing the layout from a FlexLayout to a Grid inside the DelayedView, the first tab will display nothing. When i open the next tab which is displaying the same kind of DelayedView(a new object from the same type) it gets displayed correctly. only the first Tab with its content will not be displayed. There is no exception being thrown or displayed in the logcat

To Reproduce

Tabviewswitcher

<tabs:ViewSwitcher x:Name="Switcher"
                               Animate="True"
                               SelectedIndex="{Binding SelectedViewModelIndex, Mode=TwoWay}">

                    <tabs:DelayedView x:TypeArguments="contentViews:LobiPageView"
                                      AccentColor="White"
                                      BindingContext="{Binding Page1ViewModel}"
                                      Animate="True"
                                      UseActivityIndicator="True" />
                    <tabs:DelayedView x:TypeArguments="contentViews:LobiPageView"
                                      BindingContext="{Binding Page2ViewModel}"
                                      AccentColor="{StaticResource Primary}"
                                      Animate="True"
                                      UseActivityIndicator="True" />
                    <tabs:DelayedView x:TypeArguments="contentViews:LobiPageView"
                                      BindingContext="{Binding Page3ViewModel}"
                                      AccentColor="{StaticResource Primary}"
                                      Animate="True"
                                      UseActivityIndicator="True" />
                    <tabs:DelayedView x:TypeArguments="contentViews:LobiPageView"
                                      BindingContext="{Binding Page4ViewModel}"
                                      AccentColor="{StaticResource Primary}"
                                      Animate="True"
                                      UseActivityIndicator="True" />
                    <tabs:DelayedView x:TypeArguments="contentViews:LobiPageView"
                                      BindingContext="{Binding Page5ViewModel}"
                                      AccentColor="{StaticResource Primary}"
                                      Animate="True"
                                      UseActivityIndicator="True" />

                </tabs:ViewSwitcher>

DelayedView ContentView

<StackLayout>
    <Grid BindableLayout.ItemsSource="{Binding PageItems}" >

        <Grid.RowDefinitions>
            <RowDefinition></RowDefinition>
            <RowDefinition></RowDefinition>
            <RowDefinition></RowDefinition>
            <RowDefinition></RowDefinition>
        </Grid.RowDefinitions>
        <Grid.ColumnDefinitions>
            <ColumnDefinition></ColumnDefinition>
            <ColumnDefinition></ColumnDefinition>
            <ColumnDefinition></ColumnDefinition>
            <ColumnDefinition></ColumnDefinition>
            <ColumnDefinition></ColumnDefinition>
        </Grid.ColumnDefinitions>
        <BindableLayout.ItemTemplate>
            <DataTemplate>
....
</DataTemplate>
</Grid>
</stackLayout>

Screenshots (if applicable) First Page is not displayed image Scond Tab is displayed correctly with the same contentview image


Solution

  • This seems to be a maui bug.

    The Workaround is to handle the selectted TabIndex by myself and hide an empty StackLayout on the first index of the TabviewSwitcher