Skip to content

Conversation

@github-actions
Copy link
Contributor

Backport of #31902 to release/10.0.1xx

/cc @PureWeen @karthikraja-arumugam

@PureWeen PureWeen marked this pull request as draft October 17, 2025 15:04
@rmarinho rmarinho added this to the .NET 10.0 GA milestone Oct 18, 2025
@PureWeen PureWeen marked this pull request as ready for review October 20, 2025 20:32
Copilot AI review requested due to automatic review settings October 20, 2025 20:32
@PureWeen
Copy link
Member

/azp run

@azure-pipelines
Copy link

Azure Pipelines could not run because the pipeline triggers exclude this branch/path.

@PureWeen PureWeen added the p/0 Current heighest priority issues that we are targeting for a release. label Oct 20, 2025
@PureWeen PureWeen moved this from Todo to Approved in MAUI SDK Ongoing Oct 20, 2025
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Comment on lines +214 to +222
public List<Issue31897Project> Projects
{
get { return _projects; }
set
{
_projects = value;
OnPropertyChanged(nameof(Projects));
}
}
Copy link

Copilot AI Oct 20, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[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.

Copilot uses AI. Check for mistakes.

public void AddItems(int count)
{
var currentProjects = new List<Issue31897Project>(_projects);
Copy link

Copilot AI Oct 20, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[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.

Copilot uses AI. Check for mistakes.
@PureWeen
Copy link
Member

  • failing tests are unrelated

@PureWeen PureWeen merged commit a051c2f into release/10.0.1xx Oct 21, 2025
4 of 7 checks passed
@PureWeen PureWeen deleted the backport/pr-31902-to-release/10.0.1xx branch October 21, 2025 14:36
@github-project-automation github-project-automation bot moved this from Approved to Done in MAUI SDK Ongoing Oct 21, 2025
@github-actions github-actions bot locked and limited conversation to collaborators Nov 21, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

p/0 Current heighest priority issues that we are targeting for a release.

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

5 participants