Skip to content

Conversation

@SubhikshaSf4851
Copy link
Contributor

Note

Are you waiting for the changes in this PR to be merged?
It would be very helpful if you could test the resulting artifacts from this PR and let us know in a comment if this change resolves your issue. Thank you!

Root Cause:

CarouselView does not utilize the ItemSpacing property during layout styling

Description of Change

Added an item container style based on the horizontal or vertical orientation of the CarouselView, and applied a corresponding style to the ListViewBase

Issues Fixed

Fixes #29772

Tested the behaviour in the following platforms

  • Windows
  • Android
  • iOS
  • Mac

Screenshot

Before Issue Fix After Issue Fix

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

Hey there @@SubhikshaSf4851! 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 Jun 16, 2025
@jsuarezruiz jsuarezruiz added platform/windows area-controls-collectionview CollectionView, CarouselView, IndicatorView labels Jun 17, 2025
@jsuarezruiz
Copy link
Contributor

/azp run MAUI-UITests-public

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@jsuarezruiz
Copy link
Contributor

/azp run MAUI-UITests-public

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@SubhikshaSf4851 SubhikshaSf4851 marked this pull request as ready for review June 20, 2025 14:36
Copilot AI review requested due to automatic review settings June 20, 2025 14:36
@SubhikshaSf4851 SubhikshaSf4851 requested a review from a team as a code owner June 20, 2025 14:36
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 enables ItemSpacing for CarouselView on Windows by applying an ItemContainerStyle and adjusting item size calculations, and adds a UI test to verify the fix.

  • Added a host app page and shared UI test for Issue 29772
  • Updated CarouselViewHandler.Windows to set container padding and account for ItemSpacing when measuring items

Reviewed Changes

Copilot reviewed 3 out of 6 changed files in this pull request and generated 3 comments.

File Description
src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue29772.cs Added a UI test for ItemSpacing but gated to iOS/Catalyst only
src/Controls/tests/TestCases.HostApp/Issues/Issue29772.cs Host app page with a CarouselView setup, binding, and automation ID for testing ItemSpacing
src/Controls/src/Core/Handlers/Items/CarouselViewHandler.Windows.cs Applied ItemContainerStyle and updated GetItemWidth/GetItemHeight to subtract spacing

if (CarouselItemsLayout.Orientation == ItemsLayoutOrientation.Horizontal)
{
itemWidth = ListViewBase.ActualWidth - ItemsView.PeekAreaInsets.Left - ItemsView.PeekAreaInsets.Right;
if (ItemsView.PeekAreaInsets.Left > 0 || ItemsView.PeekAreaInsets.Right > 0)
Copy link

Copilot AI Jun 20, 2025

Choose a reason for hiding this comment

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

ItemSpacing subtraction is gated on peek insets; spacing should be subtracted regardless of peek area to correctly space items.

Copilot uses AI. Check for mistakes.
if (CarouselItemsLayout.Orientation == ItemsLayoutOrientation.Vertical)
{
itemHeight = ListViewBase.ActualHeight - ItemsView.PeekAreaInsets.Top - ItemsView.PeekAreaInsets.Bottom;
if (ItemsView.PeekAreaInsets.Left > 0 || ItemsView.PeekAreaInsets.Right > 0)
Copy link

Copilot AI Jun 20, 2025

Choose a reason for hiding this comment

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

Vertical sizing logic checks Left/Right peek insets instead of Top/Bottom; it should use PeekAreaInsets.Top and PeekAreaInsets.Bottom for the vertical case.

Suggested change
if (ItemsView.PeekAreaInsets.Left > 0 || ItemsView.PeekAreaInsets.Right > 0)
if (ItemsView.PeekAreaInsets.Top > 0 || ItemsView.PeekAreaInsets.Bottom > 0)

Copilot uses AI. Check for mistakes.
@@ -0,0 +1,24 @@
#if TEST_FAILS_ON_IOS && TEST_FAILS_ON_CATALYST // Open PR for iOS and Mac https://github.com/dotnet/maui/pull/27056
Copy link

Copilot AI Jun 20, 2025

Choose a reason for hiding this comment

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

The UI test is only enabled for iOS and Catalyst; it should also run on Windows to verify ItemSpacing for the Windows handler implementation.

Copilot uses AI. Check for mistakes.
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 partner/syncfusion Issues / PR's with Syncfusion collaboration platform/windows

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ItemSpacing on CarouselView is not applied on Windows.

2 participants