2

How do you guys handle the safe area problem for ListViews with Xamarin.Forms? Just setting the safe area as margin on the whole ListView looks ugly AF. So I search for something like a custom renderer to make the ListView as equal als possible to the UITableView in the iPhone X. My current solution bringt the ViewCells in the correct position but the Seperator is going off screen and the ShortGroup index is behind the Notch in some rotations. Beside from that, my current solution is way to much work to implement it in every project (because I use a CustomViewCell class as Workaround).

So how to implement a custom renderer for this problem? All of my current implementations seems not to work properly. And I guess waiting for Xamarin to fix this is not an option (because MasterDetail pages still not work on iOS SplitView and this was reported back in 2015 and is just ignored by Xamarin...).

Edit: The problem with the ListView in Xamarin.Forms did only occur if the ListView control is not the root of the ContentPage. In my case it is inside a Grid because I want a SearchBar too on this side. In this case the content of the ListView (and the ShortGroup index) gets cut off by the iPhone X rounded corners and the notch. It looks really ugly and I guess it is a very common way to have a SearchBar and a ListView on one side. Here is a repository of a project which has a first workaround (the ShortGroup index still has the problem there and also the separator runs outside of the visible area while it normally would stop before that): https://github.com/Sebastian1989101/OpenGeoDB-App

Sebastian
  • 259
  • 3
  • 18
  • You should add some sample code that you have tried so far and some screenshots about how it looks and why it doesn't look very nice. Then maybe a screenshot detailing what you would like it to look like. – Nordeast Nov 21 '17 at 22:23
  • I don't know how screenshot should help there? Currently the ListView is rendered for a normal display and not for one with a notch and rounded corners. And exact that is the problem. If the devices goes into landscape the content (and/or ShortGroup Index) gets cut off. And I want it to act like a native iOS app does - setting a padding to the content so it is in the SafeArea. – Sebastian Nov 21 '17 at 23:16
  • Are using the latest stable version of Xamarin.Forms? – cvanbeek Nov 21 '17 at 23:26
  • If so, check out this blog post: https://blog.xamarin.com/making-ios-11-even-easier-xamarin-forms/ – cvanbeek Nov 21 '17 at 23:27
  • 1
    I already checked this blog post and to add margins to a list view is ugly as f*ck. Also Xamarin has a smooth solution (or it seems so) if the ListView is the root element of a page. But if you had Ads and a SearchBar it might be nested in a Grid and in this case the SafeArea padding gets ignored. Also there is no property to set the margin... especially the ShortGroup index at the right side is messing up (I got a small workaround for the rest of the ListView but the index list won't work...) – Sebastian Nov 22 '17 at 21:43
  • @Sebastian could you describe what have you ended up with? – Mikalai Daronin Jan 20 '18 at 11:01
  • I to have run into this issue and am interested in how you solved it. – SolidSnake4444 Aug 16 '19 at 00:57

0 Answers0