【问题标题】:Xamarin.Forms ListView does not highlight selected item?Xamarin.Forms ListView 不突出显示所选项目?
【发布时间】:2019-10-28 19:10:46
【问题描述】:

尝试在 Xamarin.Forms 上增加一个新项目,而在 iOS 13 上,我的 ListViews 上没有显示任何突出显示。使用 Visual Studio for Mac 开箱即用的“Blank Forms App”解决方案,我将 MainPage.xaml 上的内容更改为:

<?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="ListViewTest.MainPage">
    <StackLayout>
        <ListView SelectionMode="Single">
            <ListView.ItemsSource>
                <x:Array Type="{x:Type x:String}">
                    <x:String>mono</x:String>
                    <x:String>monodroid</x:String>
                    <x:String>monotouch</x:String>
                    <x:String>monorail</x:String>
                    <x:String>monodevelop</x:String>
                    <x:String>monotone</x:String>
                    <x:String>monopoly</x:String>
                    <x:String>monomodal</x:String>
                    <x:String>mononucleosis</x:String>
                </x:Array>
            </ListView.ItemsSource>
        </ListView>
    </StackLayout>

选择“monotouch”后,模拟器和设备上的视图都如下图所示。我本来希望“monotouch”行上有一个灰色的选择栏,但它只修改了行边框。

这是在 Xamarin.Forms 4.3.0.908675(截至此日期的最新版本)上。我尝试回滚到 Forms 4.0 和 3.6 并在两者上看到相同的结果,这让它看起来像是 iOS 13 中的新功能?

我尝试搜索其他有问题的人,但只找到有关更改或隐藏突出显示颜色的文章;我只是想匹配系统行为。

有没有其他人碰到过这个?有任何想法吗?谢谢!

【问题讨论】:

  • 你试过iOS 12模拟器吗?
  • 这是 Xam.Forms 和 iOS 13 的一个已知问题(由于 ioS 对原生 UITableView 所做的更改),并且在 11 小时前合并了一个修复程序,因此该修复程序应该在下一个版本中.见:github.com/xamarin/Xamarin.Forms/issues/7850
  • 谢谢!当我第一次遇到这个问题时,它还没有被打开;我应该在发布之前考虑再次搜索。您能否将您的评论重新发布为答案,以便我接受?

标签: listview xamarin xamarin.forms ios13


【解决方案1】:

新版本修复了这个错误

2019 年 10 月 30 日,星期三 - Xamarin.Forms 4.3.0.947036 (4.3.0 服务版本 1)

https://docs.microsoft.com/en-us/xamarin/xamarin-forms/release-notes/4.3/4.3.0-sr1

【讨论】:

    猜你喜欢
    • 2016-07-31
    • 2013-04-17
    • 2011-08-16
    • 2012-06-23
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-02-04
    相关资源
    最近更新 更多