Skip to content

CollectionView.ItemsLayout LinearItemsLayout ItemSpacing behaves significantly differently on Windows compared to Android (possibly Mac/iOS too) #38959

Closed

Description

@Deus-nsf

Description

It looks like Windows is almost x3 compared to Android:

Windows:

Image

Android:

Image

Xaml code (I'll provide the full sample right below):

`

<VerticalStackLayout Padding="30,0"
					 Spacing="25"
					 BackgroundColor="AliceBlue">
	<CollectionView ItemsSource="{Binding Models}"
					HeightRequest="800">
		<CollectionView.ItemsLayout>
			<LinearItemsLayout Orientation="Vertical"
							   ItemSpacing="30" />
		</CollectionView.ItemsLayout>
		<CollectionView.ItemTemplate>
			<DataTemplate x:DataType="approot:Model">
				<Border HeightRequest="40"
						WidthRequest="300"
						BackgroundColor="Blue">
					<Label Text="{Binding Field}"
						   FontSize="16"
						   TextColor="Black" />
				</Border>
			</DataTemplate>
		</CollectionView.ItemTemplate>
	</CollectionView>
</VerticalStackLayout>
`

Steps to Reproduce

Just create a collection view with items inside (the control doesn't matter) and play around with the ItemSpacing property and compare the visual result between Windows and Android (and possibly iOS too).

Link to public reproduction project repository

https://github.com/Deus-nsf/CollectionViewSpacing-MAUI-issue

Version with bug

10.0.110

Is this a regression from previous behavior?

Not sure, did not test other versions

Last version that worked well

Unknown/Other

Affected platforms

Windows

Affected platform versions

WIndows 10

Did you find any workaround?

Nope :)

Relevant log output

Activity

  1. added
    t/bug
    on Sep 28, 2026
  2. changed the title [-]CollectionView.ItemsLayout LinearItemsLayout ItemSpacing behaves significantly differently on Windows compared to Android (possibly Mac/iOS too))[/-] [+]CollectionView.ItemsLayout LinearItemsLayout ItemSpacing behaves significantly differently on Windows compared to Android (possibly Mac/iOS too)[/+] on Sep 28, 2026
  3. added a commit that references this issue on Sep 28, 2026
    6592513
  4. added this to the .NET 10 SR12 milestone on Sep 28, 2026
  5. NafeelaNazhir commented on Sep 29, 2026

    @NafeelaNazhir
    Contributor

    This issue has been validated in Visual Studio Insiders [12202.211] with .NET MAUI versions 10.0.0 and 10.0.110. It can be reproduced on Windows platform.

    Windows Output Android Output
    Image Image
  6. added
    area-controls-collectionview
    s/verified
    s/triaged
    on Sep 29, 2026
  7. kubaflo commented on Oct 3, 2026

    @kubaflo
  8. github-actions commented on Oct 3, 2026

    @github-actions
    Contributor

    Regression Trace

    @Deus-nsf — regression investigation for #38959.

    Scope Regression trace Range unknown


    🔎 Regression Analysis — click to expand

    Insufficient evidence: The failing release contains a concrete Windows/Android spacing difference, but no introducing commit or PR can be supported. A previously working MAUI version is unknown; this could be a longstanding platform inconsistency rather than a recent regression.

    📊 Version boundary

    The original report describes Windows 10, a vertical CollectionView with ItemSpacing=30 and 40-unit-high Borders, and visibly larger gaps than Android. Expected: comparable logical spacing across platforms. iOS/MacCatalyst are conjectured, not demonstrated.

    Observed failing MAUI version: 10.0.110, resolved to 6c379bf, not an established first bad release. A contributor subsequently reports reproduction on both 10.0.0 and 10.0.110. That adds an earlier failing observation, not a passing boundary.

    The frozen context has no good-to-bad comparison because “Unknown/Other” cannot resolve a good tag. Comments are not truncated. Path-history results were unavailable in this run, so shipped introduction/backport ancestry remains unverified.


    🧬 Candidate changes

    No introducing change is attributable. At the failing SHA, Windows GetVerticalItemContainerStyle assigns the full ItemSpacing to both top and bottom container margins. In contrast, Android SpacingItemDecoration assigns half-spacing per side, converts to pixels, and removes outer-edge spacing.

    This supports a doubled inter-container spacing contribution on Windows, but does not establish the reported approximately threefold visual ratio or when the difference began. Static inspection is not a reproduction, paired runtime comparison, or bisect.


    🧭 Follow-up — actions and refresh

    Next action: Identify one exact MAUI version where this same sample has correct Windows spacing. Compare it with 10.0.0 under equivalent OS, display scaling, SDK/workload and Windows App SDK conditions, recording logical item bounds. Then refresh context and trace that bounded interval; confirm any candidate by comparing its parent and candidate under those same conditions.

    Maintainers: comment /issue trace-regression to refresh this report.

  9. added 2 commits that reference this issue on Oct 3, 2026
    e565f45
    692ebf9
  10. kubaflo commented on Oct 10, 2026

    @kubaflo
    Contributor

    Thank you for the report and the investigation details. We are closing this as completed: the default Windows CollectionView handler now applies the requested item spacing once rather than doubling the paired spacing contributions.

    Supporting evidence: #38960 (merged into inflight/current).

    This records the merged source change; it does not imply that the fix is present in every released .NET MAUI package.

    If you can still reproduce the reported behavior in a build that includes the linked change, please comment here with the exact version and reproduction details so we can reopen and investigate. The existing reproduction and discussion remain available; a new issue is not required.

  11. added 6 commits that reference this issue on Oct 13, 2026
    d17b56a
    00962e3
    94f7f50
    8fd4dd9
    bd1aaee
    6ac9506
  12. added a commit that references this issue on Oct 28, 2026
    a68a5e3
  13. locked and limited conversation to collaborators on Nov 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area-controls-collectionviewplatform/windowss/triageds/verifiedt/bug

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions