CommunityToolkit / CommunityToolkit/Windows

Bug: UniformGridLayout can leave empty gaps after resizing while scrolled

Aperta
#869 2 commenti 0 reazioni 0 assegnatari Vedi su GitHub
Lingua principale
C#
Stelle
1.1k
Fork
166
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Descrizione

### Describe the bug

## Describe the bug

`UniformGridLayout` can leave empty gaps in an `ItemsRepeater` after resizing the available width while the control is scrolled.

Some items disappear from the viewport, leaving blank spaces where the items should be. Simply scrolling a small amount causes the missing items to reappear.

## Steps to reproduce

1. Display a large collection of items using `ItemsRepeater` with `UniformGridLayout`.
2. Ensure virtualization is active (enough items to require scrolling).
3. Scroll down several rows.
4. Resize the available width of the `ItemsRepeater` (for example by moving a `GridSplitter` that changes the width of its parent container).
5. Observe that some visible positions become empty.
6. Scroll slightly up or down.
7. The missing items reappear.

## Expected behavior

After a width change, all visible items should remain correctly realized and positioned.

No empty gaps should appear.

## Actual behavior

After resizing while scrolled:

* Some items disappear from the viewport.
* Empty spaces remain where those items should be.
* A small scroll causes the missing items to reappear.

This suggests the layout/virtualization state becomes inconsistent after the width change.

## Environment

* Windows App SDK: (fill in version)
* WinUI: (fill in version)
* Windows version: (fill in version)

## Additional information

The issue appears only after the control has been scrolled.

Resizing while already at the top of the list is much harder (or impossible) to reproduce.

The problem is consistently reproducible in a grid using `UniformGridLayout` with virtualization enabled after changing the available width.

### Steps to reproduce

```text
## Steps to reproduce

1. Create an `ItemsRepeater` using `UniformGridLayout` with enough items to enable virtualization and scrolling.
2. Place the `ItemsRepeater` in a layout where its available width can change at runtime (for example, by resizing a neighboring panel with a `GridSplitter`).
3. Scroll down several rows so the viewport is no longer at the top of the list.
4. Resize the available width of the `ItemsRepeater`.
5. Observe that some items disappear, leaving empty gaps in the grid.
6. Scroll slightly up or down.
7. Observe that the missing items immediately reappear.

## Reproducibility

Occurs consistently in this scenario after scrolling and resizing the available width of the `ItemsRepeater`.
```

### Expected behavior

## Expected behavior

When the available width of an `ItemsRepeater` using `UniformGridLayout` changes, the layout should correctly recalculate the positions of all visible items.

No visible items should disappear or leave empty gaps in the grid. The realized items and scroll extent should remain consistent before, during, and after the resize, without requiring any additional user interaction (such as scrolling) to restore the correct layout.

### Screenshots

_No response_

### Code Platform

- [ ] UWP
- [x] WinAppSDK / WinUI 3
- [ ] Web Assembly (WASM)
- [ ] Android
- [ ] iOS
- [ ] MacOS
- [ ] Linux / GTK

### Windows Build Number

- [ ] Windows 10 1809 (Build 17763)
- [ ] Windows 10 1903 (Build 18362)
- [ ] Windows 10 1909 (Build 18363)
- [ ] Windows 10 2004 (Build 19041)
- [ ] Windows 10 20H2 (Build 19042)
- [ ] Windows 10 21H1 (Build 19043)
- [ ] Windows 10 21H2 (Build 19044)
- [ ] Windows 10 22H2 (Build 19045)
- [ ] Windows 11 21H2 (Build 22000)
- [ ] Windows 11 22H2 (Build 22621)
- [ ] Windows 11 23H2 (Build 22631)
- [ ] Windows 11 24H2 (Build 26100)
- [ ] Windows 11 25H2 (Build 26200)
- [x] Windows 11 26H1 (Build 28000)
- [ ] Other (specify)

### Other Windows Build number

_No response_

### App minimum and target SDK version

- [ ] Windows 10, version 1809 (Build 17763)
- [ ] Windows 10, version 1903 (Build 18362)
- [ ] Windows 10, version 1909 (Build 18363)
- [ ] Windows 10, version 2004 (Build 19041)
- [ ] Windows 10, version 2104 (Build 20348)
- [ ] Windows 11, version 22H2 (Build 22000)
- [ ] Windows 11, version 24H2 (Build 26100)
- [ ] Windows 11, version 25H2 (Build 26200)
- [x] Windows 11, version 26H1 (Build 28000)
- [ ] Other (specify)

### Other SDK version

_No response_

### Visual Studio Version

2026

### Visual Studio Build Number

_No response_

### Device form factor

Desktop

### Additional context

_No response_

### Help us help you

Yes, I'd like to be assigned to work on this item.

Guida per i contributori

Apri la guida per i contributori

Direzione di ricerca

Inizia riproducendo il problema con un ItemsRepeater usando UniformGridLayout, la virtualizzazione, lo scorrimento e una modifica della larghezza in fase di esecuzione. Esamina il comportamento del layout e della virtualizzazione durante il ridimensionamento, quindi verifica che tutti gli elementi visibili rimangano realizzati e posizionati senza spazi vuoti e ricompaiano senza ulteriore scorrimento.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Valutazione

Stack tecnologico
csharp
Ambito
frontend
Tipo di issue
Bug
Difficoltà
4/5
Tempo stimato
3-5 giorni
Stato di attività
Attiva
Chiarezza
Abbastanza chiara
Idoneità per principianti
48/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.