Это можно сделать с помощью Пользовательского рендерера
using UIKit;
using Xamarin.Forms.Platform.iOS;
using Xamarin.Forms;
using App7.iOS;
[assembly:ExportRenderer(typeof(ViewCell),typeof(MyViewCellRenderer))]
namespace App7.iOS
{
public class MyViewCellRenderer: ViewCellRenderer
{
public override UITableViewCell GetCell(Cell item, UITableViewCell reusableCell, UITableView tv)
{
var cell= base.GetCell(item, reusableCell, tv);
cell.SelectedBackgroundView = new UIView
{
BackgroundColor = Color.Transparent.ToUIColor(),
};
cell.SelectionStyle = UITableViewCellSelectionStyle.None;
return cell;
}
}
}
в xaml
<CollectionView.ItemTemplate >
<DataTemplate >
<ViewCell>
<ContentView BackgroundColor="Transparent" HorizontalOptions="FillAndExpand" VerticalOptions="FillAndExpand" Margin="0, 0, 0, 20" />
</ViewCell>
</DataTemplate>
</CollectionView.ItemTemplate>
Обновление
Вы можете использовать плагин FlowListView от Nuget. Он предоставляет функцию, аналогичную функции CollectionView.
И вы можете создавать собственные средства визуализации для FlowListViewInternalCell в платформах, определяющих c проекты, которые отключают подсветку строк ListView.
iOS
using System;
using DLToolkit.Forms.Controls;
using DLToolkitControlsSamples.iOS;
using UIKit;
using Xamarin.Forms;
using Xamarin.Forms.Platform.iOS;
[assembly: ExportRenderer(typeof(FlowListViewInternalCell), typeof(FlowListViewInternalCellRenderer))]
namespace DLToolkitControlsSamples.iOS
{
// DISABLES FLOWLISTVIEW ROW HIGHLIGHT
public class FlowListViewInternalCellRenderer : ViewCellRenderer
{
public override UIKit.UITableViewCell GetCell(Xamarin.Forms.Cell item, UIKit.UITableViewCell reusableCell, UIKit.UITableView tv)
{
tv.AllowsSelection = false;
var cell = base.GetCell(item, reusableCell, tv);
cell.SelectionStyle = UITableViewCellSelectionStyle.None;
return cell;
}
}
}
Android
using System;
using DLToolkit.Forms.Controls;
using DLToolkitControlsSamples.Droid;
using Xamarin.Forms;
using Xamarin.Forms.Platform.Android;
[assembly: ExportRenderer(typeof(FlowListViewInternalCell), typeof(FlowListViewInternalCellRenderer))]
namespace DLToolkitControlsSamples.Droid
{
// DISABLES FLOWLISTVIEW ROW HIGHLIGHT
public class FlowListViewInternalCellRenderer : ViewCellRenderer
{
protected override Android.Views.View GetCellCore(Cell item, Android.Views.View convertView, Android.Views.ViewGroup parent, Android.Content.Context context)
{
var cell = base.GetCellCore(item, convertView, parent, context);
var listView = parent as Android.Widget.ListView;
if (listView != null)
{
listView.SetSelector(Android.Resource.Color.Transparent);
listView.CacheColorHint = Android.Graphics.Color.Transparent;
}
return cell;
}
}
}
Для более подробной информации и использования плагина вы можете проверить https://github.com/daniel-luberda/DLToolkit.Forms.Controls/tree/master/FlowListView/