【问题标题】:Xamarin.Forms TabbedPage bugXamarin.Forms TabbedPage 错误
【发布时间】:2021-04-11 17:06:46
【问题描述】:

我已经使用 Xamarin.Forms 为 android 和 ios 创建了一个应用程序。在android上一切正常,但我对ios有一点问题。我的应用程序包含一个由两个不同选项卡组成的 TabbedPage。每个选项卡都是一个内容页面,里面有一个列表视图。这是代码:

<TabbedPage 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"
         x:Class="MyApp.Views">

<TabbedPage.Children>
    <ContentPage x:Name="page1">
        <ContentPage.ToolbarItems>
            <ToolbarItem Icon="more.png" Clicked="ToolbarItem_Clicked"/>
        </ContentPage.ToolbarItems>
        <ListView ItemsSource="{Binding JobsToDo}"
                  x:Name="listView"
                  VerticalScrollBarVisibility="Always"
                  RowHeight="240"
                  SeparatorColor="Transparent"
                  BackgroundColor="#fffffd"
                      SelectionMode="None" ItemTemplate="{StaticResource startJob}" />
    </ContentPage>

    <ContentPage x:Name="page2">
        <ListView 
        ItemsSource="{Binding JobsEnded}"
                  VerticalScrollBarVisibility="Always"
                  RowHeight="240"
                  SeparatorColor="#4b4b4b"
                  BackgroundColor="#fffffd"
                      SelectionMode="None" ItemTemplate="{StaticResource endJob}" />
    </ContentPage>
</TabbedPage.Children>

问题是“page2”中的第二个 ListView 被冻结,我无法滚动它。 “page1”中的 ListView 工作正常。我注意到,当您在 IOS 上使用带有 2 个或更多选项卡的 TabbedPage 并且其中一个选项卡包含 ListView 时,ListView 也会被冻结。这是一个错误还是我做错了什么?请帮帮我

【问题讨论】:

  • 您使用的是哪个版本的 XF?您是否在多个设备或模拟器上尝试过?第二个 ListView 是否有足够的数据使其滚动?它是否响应点击或选择事件?
  • 您好,我无法在我的本地站点中复制此内容。如果您有时间可以分享有问题的示例项目链接,最好检查一下问题所在。

标签: listview xamarin xamarin.ios tabbedpage


【解决方案1】:

我找到了解决问题的方法。我已将 XF 从 4.7 更新到最新版本,现在在两个平台上一切正常。

【讨论】:

    猜你喜欢
    • 2017-03-16
    • 1970-01-01
    • 2021-06-11
    • 2019-10-16
    • 2019-03-23
    • 2014-09-24
    • 1970-01-01
    • 2018-05-05
    • 2021-11-26
    相关资源
    最近更新 更多