Sharpnado Tabs的第一个标签页未显示。

huangapple go评论75阅读模式
英文:

Sharpnado Tabs First Tab is not showing

问题

我正在使用TabSwitcher中的DelayedViews。当我将布局从FlexLayout更改为DelayedView内部的Grid时,第一个选项卡将不显示任何内容。当我打开下一个选项卡时,它显示了正确的内容,该选项卡也显示了相同类型的DelayedView(来自相同类型的新对象)。

只有第一个带有其内容的选项卡将不会显示。没有任何异常被抛出或在logcat中显示。

重现步骤

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>

截图(如果适用)
第一页未显示
Sharpnado Tabs的第一个标签页未显示。
第二个选项卡显示了相同内容的正确内容
Sharpnado Tabs的第一个标签页未显示。

英文:

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
Sharpnado Tabs的第一个标签页未显示。
Scond Tab is displayed correctly with the same contentview
Sharpnado Tabs的第一个标签页未显示。

答案1

得分: 0

这似乎是一个Maui的bug。

解决方法是自己处理所选的TabIndex,并在TabviewSwitcher的第一个索引上隐藏一个空的StackLayout。

英文:

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

huangapple
  • 本文由 发表于 2023年5月6日 20:53:25
  • 转载请务必保留本文链接:https://go.coder-hub.com/76189003.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定