xamarin/Xamarin.Forms

[Bug] iOS collection view items are misaligned with background

Open

#8,719 opened on Nov 29, 2019

 (4 comments) (0 reactions) (0 assignees)C# (1,926 forks)batch import
a/collectionviewe/2 :clock2:good first issuehelp wantedinactivep/iOS 🍎t/bug :bug:up-for-grabs

Repository metrics

Stars
 (5,644 stars)
PR merge metrics
 (No merged PRs in 30d)

Description

Description

On iOS, it's not possible to align content with the collection view item background, if a background colour is set.

This image for an example of what I mean:

This was produced with this Xaml:

This is only an issue on iOS, not on Android.

I've included a renderer in the iOS solution that hacks a fix in for this. After the fix, the item is displayed correctly:

I believe the issue is caused by the fact that the rendered content is given a bounds with an x of -1 and a y of -1.

Steps to Reproduce

Run the app

Expected Behavior

Background and accent are aligned

Actual Behavior

Background and accent are misaligned

Uncomment out the renderer attribute on iOS to see a hack that works around the bug

Basic Information

  • Version with issue:
  • Last known good version:
  • IDE: Visual Studio for Mac
  • Platform Target Frameworks:
    • iOS: 13.6.0.12
  • Nuget Packages: Xamarin Forms 4.3.0.991211
  • Affected Devices: iOS

Reproduction Link

https://github.com/petermajor/CollectionViewItemAlignmentBug

Contributor guide