Skip to content

Conversation

@Tamilarasan-Paranthaman
Copy link
Contributor

@Tamilarasan-Paranthaman Tamilarasan-Paranthaman commented Apr 23, 2025

Issue 1: The group header and footer templates were not updating correctly when set at runtime.

Root Cause of the issue

  • The mapper for the group header and footer templates was not implemented to support dynamic updates at runtime. As a result, changes made to the templates during runtime had no effect, and the templates were not displayed as expected.

Description of Change

  • Implemented a mapper for the group header and footer templates to enable dynamic updates at runtime. This resolves the issue.

Issue 2: After implementing the mapper for the group header and footer templates, those templates were incorrectly applied to all items when IsGrouped was set to true for an ObservableCollection.

Root Cause of the issue

  • Items in the ItemsSource collection were being cast to IEnumerable and added to the groups collection, even if they were not actually of an IEnumerable type. The number of sections (NumberOfSections) was determined based on the count of this incorrectly formed collection, leading to incorrect template application and section configuration.

Description of Change

  • Added a type check to ensure that only items implementing IEnumerable are treated as sections when updating the NumberOfSections count. Non-IEnumerable items are no longer considered as grouped sections. As a result, NumberOfSections now correctly reflects the actual grouping structure.

Issues Fixed

Fixes #29141

Test Case

Tested the behaviour in the following platforms

  • iOS
  • Android
  • Mac
  • Windows

Screenshot

Before Fix After Fix
Before-fix.mov
After-Fix.mov

@dotnet-policy-service dotnet-policy-service bot added the community ✨ Community Contribution label Apr 23, 2025
@dotnet-policy-service
Copy link
Contributor

Hey there @@Tamilarasan-Paranthaman! Thank you so much for your PR! Someone from the team will get assigned to your PR shortly and we'll get it reviewed.

@dotnet-policy-service dotnet-policy-service bot added the partner/syncfusion Issues / PR's with Syncfusion collaboration label Apr 23, 2025
@jsuarezruiz jsuarezruiz added platform/ios area-controls-collectionview CollectionView, CarouselView, IndicatorView labels Apr 23, 2025
@Tamilarasan-Paranthaman Tamilarasan-Paranthaman marked this pull request as ready for review April 25, 2025 12:22
Copilot AI review requested due to automatic review settings April 25, 2025 12:22
@Tamilarasan-Paranthaman Tamilarasan-Paranthaman requested a review from a team as a code owner April 25, 2025 12:22
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 the issue where group header and footer templates were incorrectly applied and not updating as expected when the ObservableCollection’s IsGrouped property was true.

  • Adds group header/footer template mappings for iOS in CollectionViewHandler2.iOS.cs.
  • Updates ObservableGroupedSource.cs to only add groups that implement IEnumerable.
  • Removes platform-specific mapping conditions in GroupableItemsViewHandler.cs.

Reviewed Changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

File Description
src/Controls/src/Core/Handlers/Items2/CollectionViewHandler2.iOS.cs Adds new mapping for group header/footer templates to support dynamic updates on iOS.
src/Controls/src/Core/Handlers/Items/iOS/ObservableGroupedSource.cs Adjusts group source creation with a type-check to include only IEnumerable groups.
src/Controls/src/Core/Handlers/Items/GroupableItemsViewHandler.cs Removes conditional mapping for group header/footer templates on certain platforms.


foreach (var group in source)
{
if (group is IEnumerable enumerable)
Copy link

Copilot AI Apr 25, 2025

Choose a reason for hiding this comment

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

The check 'if (group is IEnumerable enumerable)' may inadvertently treat strings as groups. Consider excluding strings (e.g., 'if (group is IEnumerable enumerable && !(group is string))') to prevent unintended behavior.

Suggested change
if (group is IEnumerable enumerable)
if (group is IEnumerable enumerable && !(group is string))

Copilot uses AI. Check for mistakes.
@jsuarezruiz
Copy link
Contributor

/azp run MAUI-UITests-public

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

Copy link
Contributor

@jsuarezruiz jsuarezruiz left a comment

Choose a reason for hiding this comment

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

There are some related tests failing on iOS and Mac:
image
Could you review if are related with the changes?

@Tamilarasan-Paranthaman
Copy link
Contributor Author

There are some related tests failing on iOS and Mac: image Could you review if are related with the changes?

@jsuarezruiz , yes, the failures were caused by these changes. I have updated the fix and committed the changes. Could you please review them and let me know if you have any concerns?

@jsuarezruiz
Copy link
Contributor

/azp run MAUI-UITests-public

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@PureWeen PureWeen added this to the .NET 9 SR9 milestone Jun 10, 2025
@PureWeen PureWeen added the p/1 Work that is important, and has been scheduled for release in this or an upcoming sprint label Jun 10, 2025
@PureWeen PureWeen moved this from Todo to Approved in MAUI SDK Ongoing Jun 10, 2025
@PureWeen PureWeen moved this from Approved to Ready To Review in MAUI SDK Ongoing Jun 10, 2025
@PureWeen PureWeen modified the milestones: .NET 9 SR9, .NET 9 SR10 Jul 3, 2025
@PureWeen PureWeen removed this from the .NET 9 SR10 milestone Aug 4, 2025
@PureWeen PureWeen added this to the .NET 9 SR11 milestone Aug 4, 2025
@PureWeen PureWeen modified the milestones: .NET 9 SR11, .NET 10 SR1 Sep 10, 2025
@PureWeen PureWeen modified the milestones: .NET 10 SR1, .NET 10.0 SR2 Nov 4, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area-controls-collectionview CollectionView, CarouselView, IndicatorView community ✨ Community Contribution p/1 Work that is important, and has been scheduled for release in this or an upcoming sprint partner/syncfusion Issues / PR's with Syncfusion collaboration platform/ios

Projects

Status: Ready To Review

Development

Successfully merging this pull request may close these issues.

[iOS] Group Header/Footer Repeated for All Items When IsGrouped is True for ObservableCollection in CollectionView

3 participants