CollectionView Fails to Preserve Scroll Offset with GridItemsLayout Using KeepScrollOffset
- Dominant language
- C#
- Stars
- 23.3k
- Forks
- 2k
- Avg merge
- 1d 14h
- Merged PRs (30d)
- 296
Description
### Description
When using ItemsUpdatingScrollMode="KeepScrollOffset" in a CollectionView with a GridItemsLayout, the scroll offset is not maintained after items are added from top . This issue occurs consistently across all supported platforms (Android, iOS, Windows, MacCatalyst).
https://github.com/user-attachments/assets/0b999eec-4d52-4b8a-b0c5-970ee7430bab
### Steps to Reproduce
1. Run the attached Sample [ItemsUpdatingScrollModeIssue.zip](https://github.com/user-attachments/files/19909669/ItemsUpdatingScrollModeIssue.zip)
2. Set the ItemsLayout as GridItemsLayout and add items observe that the scroll offset is not maintained after items are added from top. This issue occurs on both orientation vertical and horizontal.
Expected Behavior: The scroll position should remain stable (i.e., the same visible items should remain visible) after the collection is modified.
Actual Behavior: KeepScrollOffset does not maintain the scroll offset.
### Link to public reproduction project repository
_No response_
### Version with bug
9.0.60 SR6
### Is this a regression from previous behavior?
Not sure, did not test other versions
### Last version that worked well
_No response_
### Affected platforms
macOS, Windows, Android, iOS
### Affected platform versions
_No response_
### Did you find any workaround?
_No response_
### Relevant log output
```shell
```
Contributor guide
Research direction
Start by running the attached ItemsUpdatingScrollModeIssue.zip sample and reproducing the problem with GridItemsLayout in both orientations. Trace CollectionView handling of ItemsUpdatingScrollMode="KeepScrollOffset" when items are inserted at the top; done means the same visible items remain stable on Android, iOS, Windows, and MacCatalyst.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- csharp
- Domain
- desktop-dev, frontend, mobile-dev
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100