Quantcast
Channel: Xamarin.Forms — Xamarin Community Forums
Viewing all articles
Browse latest Browse all 89864

ListView separator full width iOS

$
0
0

Hi! Its possible to get a full width separator in iOS?

I implemented a custom renderer but not solved. When I debug CellLayoutMarginsFollowReadableWidth, its already false.

https://developer.xamarin.com/recipes/cross-platform/xamarin-forms/ios/ipad-listview/

https://forums.xamarin.com/discussion/comment/159290/#Comment_159290

My custom renderer is:

using CustomRenderers;
using UIKit;
using Xamarin.Forms;
using Xamarin.Forms.Platform.iOS;
using ListViewRenderer = CustomRenderers.ListViewRenderer;

[assembly: ExportRenderer(typeof(ListView), typeof(ListViewRenderer))]
[assembly: ExportRenderer(typeof(TableView), typeof(UITableViewRenderer))]

// [HACK]: Needed because of a bug in Xamarin
namespace CustomRenderers
{
    public class ListViewRenderer : Xamarin.Forms.Platform.iOS.ListViewRenderer
    {
        protected override void OnElementChanged(ElementChangedEventArgs<ListView> e)
        {
            base.OnElementChanged(e);

            if (Control == null)
                return;

            var tableView = Control as UITableView;

            tableView.CellLayoutMarginsFollowReadableWidth = false;
        }
    }

    public class UITableViewRenderer : Xamarin.Forms.Platform.iOS.TableViewRenderer
    {
        protected override void OnElementChanged(ElementChangedEventArgs<TableView> e)
        {
            base.OnElementChanged(e);

            if (Control == null)
                return;

            var tableView = Control as UITableView;

            tableView.CellLayoutMarginsFollowReadableWidth = false;
        }
    }
}

Any ideas?

Xamarin Forms 2.3.5.256-pre6
iPhone 5 iOS 9.1


Viewing all articles
Browse latest Browse all 89864

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>