[release/10.0.1xx] [iOS, Catalyst] Fixed CollectionView items height appears larger in Developer Balance sample#32046
Conversation
|
/azp run |
|
Azure Pipelines could not run because the pipeline triggers exclude this branch/path. |
There was a problem hiding this comment.
Pull Request Overview
This PR fixes a bug where CollectionView items appeared with incorrect height calculations in horizontal scroll scenarios on iOS and Catalyst platforms. The fix ensures that CollectionView properly measures and maintains a consistent height of 250 pixels regardless of items source changes.
Key changes:
- Modified content size calculation logic to be orientation-aware
- Added helper method to retrieve scroll direction from the underlying UICollectionView
- Comprehensive test coverage added to validate height consistency across various data operations
Reviewed Changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
src/Controls/src/Core/Handlers/Items2/ItemsViewHandler2.iOS.cs |
Refactored GetDesiredSize to use orientation-aware content size calculation, fixing dimension-specific measurement logic |
src/Controls/src/Core/Handlers/Items2/iOS/ItemsViewController2.cs |
Added GetScrollDirection() method to expose UICollectionView scroll orientation |
src/Controls/tests/TestCases.HostApp/Issues/Issue31897.cs |
Created UI test page with horizontal CollectionView and controls to test height stability across data mutations |
src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue31897.cs |
Implemented automated test verifying CollectionView maintains 250px height through add/remove/update operations |
| public List<Issue31897Project> Projects | ||
| { | ||
| get { return _projects; } | ||
| set | ||
| { | ||
| _projects = value; | ||
| OnPropertyChanged(nameof(Projects)); | ||
| } | ||
| } |
There was a problem hiding this comment.
[nitpick] Property getter and setter formatting is inconsistent. The getter uses inline braces while the setter uses block braces. Consider using consistent formatting - either both inline or both block style.
|
|
||
| public void AddItems(int count) | ||
| { | ||
| var currentProjects = new List<Issue31897Project>(_projects); |
There was a problem hiding this comment.
[nitpick] Creating a new list copy in AddItems, RemoveItems, and UpdateWithNewItems methods could be simplified. Since the Projects property setter already creates a new reference by reassigning the entire list, directly modifying _projects and then calling OnPropertyChanged(nameof(Projects)) would be more efficient.
|
Backport of #31902 to release/10.0.1xx
/cc @PureWeen @karthikraja-arumugam