diff --git a/src/Controls/src/Core/Handlers/Items/iOS/StructuredItemsViewController.cs b/src/Controls/src/Core/Handlers/Items/iOS/StructuredItemsViewController.cs index 7d3835bf3f2a..41a092df4320 100644 --- a/src/Controls/src/Core/Handlers/Items/iOS/StructuredItemsViewController.cs +++ b/src/Controls/src/Core/Handlers/Items/iOS/StructuredItemsViewController.cs @@ -219,7 +219,7 @@ void UpdateHeaderFooterPosition() } } - if (_headerUIView != null && _headerUIView.Frame.Y != headerHeight) + if (_headerUIView != null && (_headerUIView.Frame.Y != -headerHeight || _headerUIView.Frame.Width != CollectionView.Frame.Width)) { _headerUIView.Frame = new CoreGraphics.CGRect(0, -headerHeight, CollectionView.Frame.Width, headerHeight); } @@ -231,7 +231,7 @@ void UpdateHeaderFooterPosition() height = ItemsViewLayout.CollectionViewContentSize.Height; } - if (_footerUIView != null && (_footerUIView.Frame.Y != height || emptyHeight > 0 || _footerUIView.Frame.Height != footerHeight)) + if (_footerUIView != null && (_footerUIView.Frame.Y != height || emptyHeight > 0 || _footerUIView.Frame.Height != footerHeight || _footerUIView.Frame.Width != CollectionView.Frame.Width)) { _footerUIView.Frame = new CoreGraphics.CGRect(0, height + emptyHeight, CollectionView.Frame.Width, footerHeight); } diff --git a/src/Controls/tests/TestCases.Android.Tests/snapshots/android/FooterWithEmptyCVShouldHaveCorrectSize.png b/src/Controls/tests/TestCases.Android.Tests/snapshots/android/FooterWithEmptyCVShouldHaveCorrectSize.png new file mode 100644 index 000000000000..eea0182c7703 Binary files /dev/null and b/src/Controls/tests/TestCases.Android.Tests/snapshots/android/FooterWithEmptyCVShouldHaveCorrectSize.png differ diff --git a/src/Controls/tests/TestCases.HostApp/Issues/Issue28580.xaml b/src/Controls/tests/TestCases.HostApp/Issues/Issue28580.xaml new file mode 100644 index 000000000000..031e45f8384e --- /dev/null +++ b/src/Controls/tests/TestCases.HostApp/Issues/Issue28580.xaml @@ -0,0 +1,58 @@ + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/Controls/tests/TestCases.HostApp/Issues/Issue28580.xaml.cs b/src/Controls/tests/TestCases.HostApp/Issues/Issue28580.xaml.cs new file mode 100644 index 000000000000..6906ed6f8733 --- /dev/null +++ b/src/Controls/tests/TestCases.HostApp/Issues/Issue28580.xaml.cs @@ -0,0 +1,10 @@ +namespace Maui.Controls.Sample.Issues; + +[Issue(IssueTracker.Github, 28580, "CollectionView footer sizing when source is empty")] +public partial class Issue28580 : ContentPage +{ + public Issue28580() + { + InitializeComponent(); + } +} \ No newline at end of file diff --git a/src/Controls/tests/TestCases.Mac.Tests/snapshots/mac/FooterWithEmptyCVShouldHaveCorrectSize.png b/src/Controls/tests/TestCases.Mac.Tests/snapshots/mac/FooterWithEmptyCVShouldHaveCorrectSize.png new file mode 100644 index 000000000000..5caf8805e298 Binary files /dev/null and b/src/Controls/tests/TestCases.Mac.Tests/snapshots/mac/FooterWithEmptyCVShouldHaveCorrectSize.png differ diff --git a/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue28580.cs b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue28580.cs new file mode 100644 index 000000000000..0c6e4877ae1c --- /dev/null +++ b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue28580.cs @@ -0,0 +1,21 @@ +using NUnit.Framework; +using UITest.Appium; +using UITest.Core; + +namespace Microsoft.Maui.TestCases.Tests.Issues; +public class Issue28580 : _IssuesUITest +{ + public Issue28580(TestDevice testDevice) : base(testDevice) + { + } + + public override string Issue => "CollectionView footer sizing when source is empty"; + + [Test] + [Category(UITestCategories.CollectionView)] + public void FooterWithEmptyCVShouldHaveCorrectSize() + { + App.WaitForElement("labelInFooter"); + VerifyScreenshot(); + } +} \ No newline at end of file diff --git a/src/Controls/tests/TestCases.WinUI.Tests/snapshots/windows/FooterWithEmptyCVShouldHaveCorrectSize.png b/src/Controls/tests/TestCases.WinUI.Tests/snapshots/windows/FooterWithEmptyCVShouldHaveCorrectSize.png new file mode 100644 index 000000000000..196b931050bc Binary files /dev/null and b/src/Controls/tests/TestCases.WinUI.Tests/snapshots/windows/FooterWithEmptyCVShouldHaveCorrectSize.png differ diff --git a/src/Controls/tests/TestCases.iOS.Tests/snapshots/ios/FooterWithEmptyCVShouldHaveCorrectSize.png b/src/Controls/tests/TestCases.iOS.Tests/snapshots/ios/FooterWithEmptyCVShouldHaveCorrectSize.png new file mode 100644 index 000000000000..e6983f6dfed0 Binary files /dev/null and b/src/Controls/tests/TestCases.iOS.Tests/snapshots/ios/FooterWithEmptyCVShouldHaveCorrectSize.png differ