如何防止分组的Listview子项在滚动时折叠

如何防止分组的Listview子项在滚动时折叠,listview,xamarin.forms,xamarin.ios,Listview,Xamarin.forms,Xamarin.ios,在iOS上,分组Listview的子项在滚动时自动折叠。在安卓系统上,他们没有。 有没有办法防止这种行为 编辑:这里有一个快速视频向您展示正在进行的操作:您可以使用自定义渲染器并将UITableViewStyle设置为组 using xxx.iOS; using Foundation; using UIKit; using CoreGraphics; using Xamarin.Forms; using Xamarin.Forms.Platform.iOS; [assembly:ExportR

在iOS上,分组Listview的子项在滚动时自动折叠。在安卓系统上,他们没有。 有没有办法防止这种行为


编辑:这里有一个快速视频向您展示正在进行的操作:

您可以使用自定义渲染器并将UITableViewStyle设置为组

using xxx.iOS;
using Foundation;
using UIKit;
using CoreGraphics;
using Xamarin.Forms;
using Xamarin.Forms.Platform.iOS;

[assembly:ExportRenderer(typeof(ListView),typeof(MyTableViewRenderer))]
namespace xxx.iOS
{
    public class MyTableViewRenderer:ListViewRenderer
    {
        protected override void OnElementChanged(ElementChangedEventArgs<ListView> e)
        {
            base.OnElementChanged(e);

            if (Control != null)
            {
                var myTableView = new UITableView(this.Bounds, UITableViewStyle.Grouped)
                {
                    Source = Control.Source
                };
                SetNativeControl(myTableView);
            }

        }

    }
}