From 7851648d63d16ab0112724fe195b18ff82e75d1b Mon Sep 17 00:00:00 2001 From: NanthiniMahalingam <105482474+NanthiniMahalingam@users.noreply.github.com> Date: Tue, 7 Jan 2025 20:07:25 +0530 Subject: [PATCH 1/5] Fixed the items bounds updating issue when dynamically adding the items --- src/Controls/src/Core/Handlers/Items/iOS/ItemsViewLayout.cs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/Controls/src/Core/Handlers/Items/iOS/ItemsViewLayout.cs b/src/Controls/src/Core/Handlers/Items/iOS/ItemsViewLayout.cs index a5665d054e9d..f0eb0565a41e 100644 --- a/src/Controls/src/Core/Handlers/Items/iOS/ItemsViewLayout.cs +++ b/src/Controls/src/Core/Handlers/Items/iOS/ItemsViewLayout.cs @@ -108,13 +108,17 @@ internal virtual bool UpdateConstraints(CGSize size) { if (size.IsCloseTo(_currentSize)) { + // Need to update the constraints when dynamically adding items of different sizes + var newBounds = new CGSize(Math.Floor(size.Width), Math.Floor(size.Height)); + ConstrainTo(newBounds); + return false; } ClearCellSizeCache(); EstimatedItemSize = CGSize.Empty; - + _currentSize = size; var newSize = new CGSize(Math.Floor(size.Width), Math.Floor(size.Height)); From 3c7fabe3c91f592919f8cd073c9eaa8448cc3b4d Mon Sep 17 00:00:00 2001 From: NanthiniMahalingam <105482474+NanthiniMahalingam@users.noreply.github.com> Date: Wed, 8 Jan 2025 17:49:05 +0530 Subject: [PATCH 2/5] Updated the fix --- src/Controls/src/Core/Handlers/Items/iOS/ItemsViewLayout.cs | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/Controls/src/Core/Handlers/Items/iOS/ItemsViewLayout.cs b/src/Controls/src/Core/Handlers/Items/iOS/ItemsViewLayout.cs index f0eb0565a41e..537f69ce4358 100644 --- a/src/Controls/src/Core/Handlers/Items/iOS/ItemsViewLayout.cs +++ b/src/Controls/src/Core/Handlers/Items/iOS/ItemsViewLayout.cs @@ -109,9 +109,7 @@ internal virtual bool UpdateConstraints(CGSize size) if (size.IsCloseTo(_currentSize)) { // Need to update the constraints when dynamically adding items of different sizes - var newBounds = new CGSize(Math.Floor(size.Width), Math.Floor(size.Height)); - ConstrainTo(newBounds); - + ConstrainTo(_currentSize); return false; } From 1ffa30d6838a4cc08dab1560977c2f51e18c4240 Mon Sep 17 00:00:00 2001 From: NanthiniMahalingam <105482474+NanthiniMahalingam@users.noreply.github.com> Date: Wed, 8 Jan 2025 19:34:17 +0530 Subject: [PATCH 3/5] Added the UI test case --- .../TestCases.HostApp/Issues/Issue26936.xaml | 18 +++++++++++ .../Issues/Issue26936.xaml.cs | 30 +++++++++++++++++++ .../Tests/Issues/Issue26936.cs | 23 ++++++++++++++ 3 files changed, 71 insertions(+) create mode 100644 src/Controls/tests/TestCases.HostApp/Issues/Issue26936.xaml create mode 100644 src/Controls/tests/TestCases.HostApp/Issues/Issue26936.xaml.cs create mode 100644 src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue26936.cs diff --git a/src/Controls/tests/TestCases.HostApp/Issues/Issue26936.xaml b/src/Controls/tests/TestCases.HostApp/Issues/Issue26936.xaml new file mode 100644 index 000000000000..f1adb8149d67 --- /dev/null +++ b/src/Controls/tests/TestCases.HostApp/Issues/Issue26936.xaml @@ -0,0 +1,18 @@ + + + +