dotnet / dotnet/maui

[Bug] Grid Spacing is not Pixel-Perfect

Open
#6,047 5 comments 10 reactions 0 assignees View on GitHub
area-layout layout-grid platform/android platform/ios platform/macos platform/windows s/triaged s/verified t/bug
Dominant language
C#
Stars
23.3k
Forks
2k
Avg merge
1d 15h
Merged PRs (30d)
290

Description

### Description

The `Spacing` in the `Grid` is not pixel-perfect, it changes according the size of the `View`.

This is a problem, especially with small spacings, which disappear completely on different screens/resolutions. In my opinion, the spacings should not be rounded, their size should always be respected in priority, they have a defined absolute value.

Reproduction project available here: https://github.com/MADSENSE/MADSENSE.MAUI.Sample.App/tree/grid-spacing-pixelPerfect

Already tracked by https://github.com/xamarin/Xamarin.Forms/issues/9331

### Expected Behavior
Spacing `1px` line always visible regardless of the Window size:
![image](https://user-images.githubusercontent.com/4254116/163138361-fa8bc7ec-3a8f-41ae-9c1a-0eb76b6923ad.png)

### Actual Behavior
Spacing `1px` line not visible or double line, depending on Window size.
![image](https://user-images.githubusercontent.com/4254116/163138388-af2e7a16-9586-4bce-9a5a-46b682cbff0b.png)

### Steps to Reproduce

````xml
















````

### Version with bug

Release Candidate 1

### Last version that worked well

Unknown/Other

### Affected platforms

iOS, Android, Windows, macOS

### Affected platform versions

Windows 10.0.19041

### Did you find any workaround?

_No response_

### Relevant log output

_No response_

Contributor guide

Open the contributing guide

Research direction

Start with the linked MADSENSE.MAUI.Sample.App reproduction and run the XML Grid example using 1px padding and row/column spacing. Compare the rendered grid across different window sizes and the listed platforms; done means the 1px spacing remains visible without disappearing or becoming a double line.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp
Domain
frontend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.