Skip to content

Fixed Footer not displayed at the Bottom When EmptyView in CV2 #28681

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

Merged
merged 9 commits into from
Apr 28, 2025

Conversation

Dhivya-SF4094
Copy link
Contributor

@Dhivya-SF4094 Dhivya-SF4094 commented Mar 28, 2025

Issue Detail:

When the EmptyView is active in the CollectionView, the Footer/Footer Template is not displayed at the bottom as expected.

Root Cause

When the EmptyView is active in CollectionView, the layout logic does not correctly position the Footer/FooterTemplate. The existing implementation fails to adjust the footer's position relative to the EmptyView, leading to improper alignment. This happens because the LayoutEmptyView method does not account for the footer's placement when the CollectionView is empty.

When footer is given as string,  footer is not being properly tagged with FooterTag when it is created or updated. Without the tag, the CollectionView cannot identify the Footer view during layout calculations, which causes the footerView to be null in the LayoutEmptyView method.

Description of Change

In ItemsViewController.cs, the LayoutEmptyView() method was updated to return a CGRect.Empty when the EmptyView is not properly initialized, ensuring correct layout calculations for the EmptyView.
In StructuredItemsViewController.cs, the LayoutEmptyView() method was overridden to adjust the footer’s position. When the EmptyView is visible, and if the EmptyView has no height, the footer is aligned to the bottom of the CollectionView's content.
The footer’s position is updated using ViewWithTag(FooterTag), ensuring that it remains correctly rendered at the bottom.
Also by adding the cell.Tag property in the UpdateDefaultSupplementaryView method, the Footer and Header is explicitly tagged with FooterTag.

Validated the behaviour in the following platforms

  • Android
  • Windows
  • iOS
  • Mac

Issues Fixed:

Fixes #28604
Fixes #28605

Screenshots

Header and Footer as String

Before After

Header and Footer as View

Before After

Header and Footer as Template

Before After

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

Hey there @Dhivya-SF4094! 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 Mar 28, 2025
@jsuarezruiz jsuarezruiz added the area-controls-collectionview CollectionView, CarouselView, IndicatorView label Mar 28, 2025
}
UpdateHeaderFooterPosition();
Copy link
Contributor

Choose a reason for hiding this comment

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

Is this change necessary? Shouldn't invoke UpdateHeaderFooterPosition if hasHeaderOrFooter is true?

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, Updated the condition by modifying the hasHeaderOrFooter value to properly account for the presence of a Header or Footer in the ItemsView. Could you please review the fix once.

Children =
{
new Label
{
Copy link
Contributor

Choose a reason for hiding this comment

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

Can set the BackgroundColor? In this way, we not only verify the position of the header/footer, also the size with the snapshot comparison.

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 Updated test sample.

@jsuarezruiz
Copy link
Contributor

/azp run

Copy link

Azure Pipelines successfully started running 3 pipeline(s).

@Dhivya-SF4094 Dhivya-SF4094 marked this pull request as ready for review April 3, 2025 08:34
@Dhivya-SF4094 Dhivya-SF4094 requested a review from a team as a code owner April 3, 2025 08:34
@jsuarezruiz
Copy link
Contributor

/azp run

Copy link

Azure Pipelines successfully started running 3 pipeline(s).

public void FooterShouldDisplayAtBottomOfEmptyView()
{
App.WaitForElement("CollectionView");
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 snapshots, already available in the latest build:
image
Could you commit the images?

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 Added the images.

@rmarinho rmarinho added this to the .NET 9 SR7 milestone Apr 11, 2025
@rmarinho rmarinho moved this from Todo to Ready To Review in MAUI SDK Ongoing Apr 11, 2025
@jsuarezruiz
Copy link
Contributor

/azp run MAUI-UITests-public

Copy link

Azure Pipelines successfully started running 1 pipeline(s).

rmarinho
rmarinho previously approved these changes Apr 21, 2025
@jsuarezruiz
Copy link
Contributor

/azp run MAUI-UITests-public

Copy link

Azure Pipelines successfully started running 1 pipeline(s).

jsuarezruiz
jsuarezruiz previously approved these changes Apr 25, 2025
@github-project-automation github-project-automation bot moved this from Ready To Review to Approved in MAUI SDK Ongoing Apr 25, 2025
@PureWeen PureWeen changed the base branch from main to inflight/current April 28, 2025 15:20
@PureWeen PureWeen dismissed stale reviews from jsuarezruiz and rmarinho April 28, 2025 15:20

The base branch was changed.

@PureWeen PureWeen merged commit 9b0f1b4 into dotnet:inflight/current Apr 28, 2025
77 checks passed
@github-project-automation github-project-automation bot moved this from Approved to Done in MAUI SDK Ongoing Apr 28, 2025
anandhan-rajagopal pushed a commit to anandhan-rajagopal/maui that referenced this pull request May 5, 2025
…t#28681)

* Fixed Footer not displayed at the Bottom When EmptyView in CV2

* Updated test sample with Background Color

* Updated fix for CV1

* Removed unwanted changes and updated screenshot

* Added comment in test sample

* Updated test sample

* Added snapshot for mac and WinUI

* Re- Added mac snapshot

* Update HeaderAndFooterShouldBeVisible.png
PureWeen pushed a commit that referenced this pull request May 5, 2025
* Fixed Footer not displayed at the Bottom When EmptyView in CV2

* Updated test sample with Background Color

* Updated fix for CV1

* Removed unwanted changes and updated screenshot

* Added comment in test sample

* Updated test sample

* Added snapshot for mac and WinUI

* Re- Added mac snapshot

* Update HeaderAndFooterShouldBeVisible.png
PureWeen pushed a commit that referenced this pull request May 5, 2025
* Fixed Footer not displayed at the Bottom When EmptyView in CV2

* Updated test sample with Background Color

* Updated fix for CV1

* Removed unwanted changes and updated screenshot

* Added comment in test sample

* Updated test sample

* Added snapshot for mac and WinUI

* Re- Added mac snapshot

* Update HeaderAndFooterShouldBeVisible.png
PureWeen added a commit that referenced this pull request May 8, 2025
For more information about inflight process check
https://github.com/dotnet/maui/wiki/Inflight-Branch-Process

## .NET MAUI Release Notes - inflight/candidate

This document contains release notes for changes from main branch to
inflight/candidate branch.

### MAUI Product Fixes
* [iOS] Fix: FlyoutPage memory leak by @bhavanesh001 in
#28769
* [Windows] Fix for CarouselView IsSwipeEnabled=False Prevents Visual
Navigation by @SubhikshaSF4852 in
#29286
* [Windows] Fix for Argument Exception raised when the GetStringSize
method of ICanvas called with default font by @SyedAbdulAzeemSF4852 in
#29048
* Removed frame styles by @Vignesh-SF3580 in
#29222
* [Android] Fixed the CollectionView Header and Footer Do Not Align with
Horizontal ItemsLayout When EmptyView is Displayed by @Ahamed-Ali in
#28779
* Add global xmlns in template by @StephaneDelcroix in
#29203
* Fixed - On iOS GestureRecognizers don't work on Span in a Label, which
doesn't get IsVisible (=true) update from its parent by
@KarthikRajaKalaimani in #29024
* Fixed Footer not displayed at the Bottom When EmptyView in CV2 by
@Dhivya-SF4094 in #28681
* Fixed typo in Connectivity.shared.cs by @corvinsz in
#29213

### Testing
* Re-enabled flaky UI test TextInEditorShouldScroll by
@NirmalKumarYuvaraj in #29167
* [Testing] Re-Enabled UI Test - Issue10222Test by @TamilarasanSF4853 in
#29226
* [Testing] Feature Matrix UITest Cases for CollectionView Selection
Feature by @LogishaSelvarajSF4525 in
#29165

### Dependency Updates
*No dependency updates in this release*

### Docs
*No documentation changes in this release*

### Housekeeping
*No housekeeping changes in this release*

## New Contributors
* @corvinsz made their first contribution in
#29213

**Full Changelog**:
main...inflight/candidate
SuthiYuvaraj pushed a commit to SuthiYuvaraj/maui that referenced this pull request May 9, 2025
…t#28681)

* Fixed Footer not displayed at the Bottom When EmptyView in CV2

* Updated test sample with Background Color

* Updated fix for CV1

* Removed unwanted changes and updated screenshot

* Added comment in test sample

* Updated test sample

* Added snapshot for mac and WinUI

* Re- Added mac snapshot

* Update HeaderAndFooterShouldBeVisible.png
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
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

Footer Not Displayed at the Bottom When EmptyView is Active in CV2
4 participants