Skip to content

Conversation

@KarthikRajaKalaimani
Copy link
Contributor

Issue Details:

When ColumnSpacing is applied to a Grid, and a child ScrollView is set to span multiple columns using Grid.ColumnSpan, the scroll content does not expand to match the full width of the ScrollView. As a result, an unintended empty space appears on the right side of the content.

Root Cause:

During the measure phase, views spanning multiple columns were measured using only the sum of the individual column widths, excluding the spacing between those columns.
However, during the arrange phase, the same views were positioned using bounds that included both column widths and inter-column spacing.

This mismatch led to the visual gap.

Example Scenario:

  • Total Grid width: 100 units
  • 3 star columns (*)
  • ColumnSpacing = 10 units
  • A view spanning all three columns would:

Measure phase: be measured for 80 units (sum of column widths)
Arrange phase: be laid out over 100 units (columns + spacing)
This discrepancy caused extra visible space on the right.

Description of Change:

The fix ensures consistency between the measure and arrange phases by adjusting the width calculation for multi-column spans.

In GridLayoutManager.cs, the logic was updated to include column spacing during measurement for any view that spans multiple columns. Specifically:

  • The UpdateKnownMeasureWidth method, and
  • The width calculation in SecondMeasurePass

were modified to add (cell.ColumnSpan - 1) * _columnSpacing to the measured width.

This ensures that spanning views are measured using the same total width they will occupy when arranged, eliminating the extra gap and restoring proper layout behavior.

Tested the behavior in the following platforms.

  • Android
  • Windows
  • iOS
  • Mac

Reference:

N/A

Issues Fixed:

Fixes #24354

Screenshots

Before After
image (6) image (6)

@dotnet-policy-service dotnet-policy-service bot added the community ✨ Community Contribution label Nov 4, 2025
@dotnet-policy-service
Copy link
Contributor

Hey there @@KarthikRajaKalaimani! Thank you so much for your PR! Someone from the team will get assigned to your PR shortly and we'll get it reviewed.

@dotnet-policy-service dotnet-policy-service bot added the partner/syncfusion Issues / PR's with Syncfusion collaboration label Nov 4, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

community ✨ Community Contribution partner/syncfusion Issues / PR's with Syncfusion collaboration

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Android] Grid ColumnSpacing affects child's scrollview content size

1 participant