diff --git a/src/Controls/samples/Controls.Sample.UITests/Issues/Issue10947.xaml b/src/Controls/samples/Controls.Sample.UITests/Issues/Issue10947.xaml
new file mode 100644
index 000000000000..54721464bfec
--- /dev/null
+++ b/src/Controls/samples/Controls.Sample.UITests/Issues/Issue10947.xaml
@@ -0,0 +1,41 @@
+
+
+
+
+
+ First Item
+ Second Item
+ Third Item
+ Fourth Item
+ Fifth Item
+ Sixth Item
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/Controls/samples/Controls.Sample.UITests/Issues/Issue10947.xaml.cs b/src/Controls/samples/Controls.Sample.UITests/Issues/Issue10947.xaml.cs
new file mode 100644
index 000000000000..dda04562112e
--- /dev/null
+++ b/src/Controls/samples/Controls.Sample.UITests/Issues/Issue10947.xaml.cs
@@ -0,0 +1,19 @@
+using Microsoft.Maui.Controls;
+using Microsoft.Maui.Controls.Xaml;
+using Microsoft.Maui.Platform;
+using Microsoft.Maui.Controls.PlatformConfiguration;
+using Microsoft.Maui.Controls.PlatformConfiguration.iOSSpecific;
+using System;
+
+namespace Maui.Controls.Sample.Issues;
+
+[XamlCompilation(XamlCompilationOptions.Compile)]
+[Issue(IssueTracker.Github, 10947, "CollectionView Header and Footer Scrolling", PlatformAffected.iOS)]
+
+public partial class Issue10947 : ContentPage
+{
+ public Issue10947()
+ {
+ InitializeComponent();
+ }
+}
diff --git a/src/Controls/src/Core/Handlers/Items/iOS/ItemsViewController.cs b/src/Controls/src/Core/Handlers/Items/iOS/ItemsViewController.cs
index 43fc156726d1..24375487d287 100644
--- a/src/Controls/src/Core/Handlers/Items/iOS/ItemsViewController.cs
+++ b/src/Controls/src/Core/Handlers/Items/iOS/ItemsViewController.cs
@@ -174,6 +174,13 @@ public override void ViewDidLoad()
EnsureLayoutInitialized();
}
+ public override void LoadView()
+ {
+ base.LoadView();
+
+ CollectionView = new MauiCollectionView(CGRect.Empty, ItemsViewLayout);
+ }
+
public override void ViewWillAppear(bool animated)
{
base.ViewWillAppear(animated);
diff --git a/src/Controls/src/Core/Handlers/Items/iOS/MauiCollectionView.cs b/src/Controls/src/Core/Handlers/Items/iOS/MauiCollectionView.cs
new file mode 100644
index 000000000000..e99148ddf62a
--- /dev/null
+++ b/src/Controls/src/Core/Handlers/Items/iOS/MauiCollectionView.cs
@@ -0,0 +1,17 @@
+using CoreGraphics;
+using UIKit;
+
+namespace Microsoft.Maui.Controls.Handlers.Items;
+
+internal class MauiCollectionView : UICollectionView
+{
+ public MauiCollectionView(CGRect frame, UICollectionViewLayout layout) : base(frame, layout)
+ {
+ }
+
+ public override void ScrollRectToVisible(CGRect rect, bool animated)
+ {
+ if (!KeyboardAutoManagerScroll.IsKeyboardAutoScrollHandling)
+ base.ScrollRectToVisible(rect, animated);
+ }
+}
\ No newline at end of file
diff --git a/src/Controls/src/Core/PublicAPI/net-ios/PublicAPI.Unshipped.txt b/src/Controls/src/Core/PublicAPI/net-ios/PublicAPI.Unshipped.txt
index d81256e3b77e..73e385879162 100644
--- a/src/Controls/src/Core/PublicAPI/net-ios/PublicAPI.Unshipped.txt
+++ b/src/Controls/src/Core/PublicAPI/net-ios/PublicAPI.Unshipped.txt
@@ -73,6 +73,7 @@ Microsoft.Maui.Controls.PointerGestureRecognizer.PointerReleasedCommand.get -> S
Microsoft.Maui.Controls.PointerGestureRecognizer.PointerReleasedCommand.set -> void
Microsoft.Maui.Controls.PointerGestureRecognizer.PointerReleasedCommandParameter.get -> object!
Microsoft.Maui.Controls.PointerGestureRecognizer.PointerReleasedCommandParameter.set -> void
+override Microsoft.Maui.Controls.Handlers.Items.ItemsViewController.LoadView() -> void
static readonly Microsoft.Maui.Controls.KeyboardAccelerator.KeyProperty -> Microsoft.Maui.Controls.BindableProperty!
static readonly Microsoft.Maui.Controls.KeyboardAccelerator.ModifiersProperty -> Microsoft.Maui.Controls.BindableProperty!
static readonly Microsoft.Maui.Controls.DragGestureRecognizer.CanDragProperty -> Microsoft.Maui.Controls.BindableProperty!
diff --git a/src/Controls/src/Core/PublicAPI/net-maccatalyst/PublicAPI.Unshipped.txt b/src/Controls/src/Core/PublicAPI/net-maccatalyst/PublicAPI.Unshipped.txt
index dc5168131ec3..c2eaaf95e009 100644
--- a/src/Controls/src/Core/PublicAPI/net-maccatalyst/PublicAPI.Unshipped.txt
+++ b/src/Controls/src/Core/PublicAPI/net-maccatalyst/PublicAPI.Unshipped.txt
@@ -72,6 +72,7 @@ Microsoft.Maui.Controls.PointerGestureRecognizer.PointerReleasedCommand.get -> S
Microsoft.Maui.Controls.PointerGestureRecognizer.PointerReleasedCommand.set -> void
Microsoft.Maui.Controls.PointerGestureRecognizer.PointerReleasedCommandParameter.get -> object!
Microsoft.Maui.Controls.PointerGestureRecognizer.PointerReleasedCommandParameter.set -> void
+override Microsoft.Maui.Controls.Handlers.Items.ItemsViewController.LoadView() -> void
static readonly Microsoft.Maui.Controls.KeyboardAccelerator.KeyProperty -> Microsoft.Maui.Controls.BindableProperty!
static readonly Microsoft.Maui.Controls.KeyboardAccelerator.ModifiersProperty -> Microsoft.Maui.Controls.BindableProperty!
static readonly Microsoft.Maui.Controls.DragGestureRecognizer.CanDragProperty -> Microsoft.Maui.Controls.BindableProperty!
diff --git a/src/Controls/tests/UITests/Tests/Issues/Issue10947.cs b/src/Controls/tests/UITests/Tests/Issues/Issue10947.cs
new file mode 100644
index 000000000000..79c433aef50f
--- /dev/null
+++ b/src/Controls/tests/UITests/Tests/Issues/Issue10947.cs
@@ -0,0 +1,38 @@
+using NUnit.Framework;
+using UITest.Appium;
+using UITest.Core;
+
+namespace Microsoft.Maui.AppiumTests.Issues;
+
+public class Issue10947 : _IssuesUITest
+{
+ public Issue10947(TestDevice device)
+ : base(device)
+ { }
+
+ public override string Issue => "CollectionView Header and Footer Scrolling";
+ string HeaderEntry => "HeaderEntry";
+ string FooterEntry => "FooterEntry";
+
+ [Test]
+ public void CollectionViewHeaderShouldNotScroll()
+ {
+ var headerEntry = App.WaitForElement(HeaderEntry);
+ var headerLocation = headerEntry.GetRect();
+ var footerEntry = App.WaitForElement(FooterEntry);
+ var footerLocation = headerEntry.GetRect();
+
+ App.Click(HeaderEntry);
+
+ var newHeaderEntry = App.WaitForElement(HeaderEntry);
+ var newHeaderLocation = headerEntry.GetRect();
+ Assert.AreEqual(headerLocation, newHeaderLocation);
+
+ App.Click(FooterEntry);
+
+ var newFooterEntry = App.WaitForElement(FooterEntry);
+ var newFooterLocation = headerEntry.GetRect();
+
+ Assert.AreEqual(footerLocation, newFooterLocation);
+ }
+}
diff --git a/src/Core/src/Platform/iOS/KeyboardAutoManagerScroll.cs b/src/Core/src/Platform/iOS/KeyboardAutoManagerScroll.cs
index 20146d154923..5d881787921b 100644
--- a/src/Core/src/Platform/iOS/KeyboardAutoManagerScroll.cs
+++ b/src/Core/src/Platform/iOS/KeyboardAutoManagerScroll.cs
@@ -317,7 +317,7 @@ internal static void AdjustPosition()
nfloat statusBarHeight;
nfloat navigationBarAreaHeight;
- if (ContainerView.FindResponder() is UINavigationController navigationController)
+ if (View.FindResponder() is UINavigationController navigationController)
{
navigationBarAreaHeight = navigationController.NavigationBar.Frame.GetMaxY();
}