Skip to content

[Windows] Fix CarouselView EmptyView display when filtering to zero items #29247

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 6 commits into
base: main
Choose a base branch
from

Conversation

Shalini-Ashokan
Copy link
Contributor

Issue Details

On Windows platforms, both the empty view and a carousel item are displayed simultaneously when a search returns no results.

Root Cause

When filtering results to zero items in CarouselView on Windows, the handler correctly sets the EmptyView to visible but does not fully reset the current item state. As a result, both the empty view and the last carousel item remain visible.

Description of Change

Set the ItemTemplate as null and disables looping to ensure the UI is properly cleared when displaying the empty view.

Validated the behavior in the following platforms

  • Android
  • Windows
  • iOS
  • Mac

Issues Fixed

Fixes #7150

Output ScreenShot

Before After
BeforeFix-7150.mp4
AfterFix-7150.mp4

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

Hey there @@Shalini-Ashokan! 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 29, 2025
@sheiksyedm sheiksyedm added area-controls-collectionview CollectionView, CarouselView, IndicatorView platform/windows 🪟 labels Apr 29, 2025
{
App.WaitForElement("FilterButton");
App.Tap("FilterButton");
VerifyScreenshot();
Copy link
Contributor

Choose a reason for hiding this comment

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

Pending snapshot on Mac.

_loopableCollectionView.IsLoopingEnabled = true;
}

ListViewBase.ItemTemplate = CarouselItemsViewTemplate;
Copy link
Contributor

Choose a reason for hiding this comment

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

Only update ItemTemplate when the value are actually changing, which reduces unnecessary UI updates and potential visual glitches.

var targetTemplate = isEmpty ? null : CarouselItemsViewTemplate;
if (ListViewBase.ItemTemplate != targetTemplate)
{
    ListViewBase.ItemTemplate = targetTemplate;
}

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@jsuarezruiz, I have updated the code section based on your suggestions.

@jsuarezruiz
Copy link
Contributor

/azp run MAUI-UITests-public

Copy link

Azure Pipelines successfully started running 1 pipeline(s).

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.

[Windows] [Scenario Day] EmptyView using Template displayed at the same time as the content
3 participants