Fix for iOS CollectionView2 ItemSizingStrategy="MeasureFirstItem" Fails to Apply Correct Sizing#29496
Conversation
|
/azp run MAUI-UITests-public |
|
Azure Pipelines successfully started running 1 pipeline(s). |
| } | ||
| } | ||
| } | ||
| public class CollectionViewViewModel |
There was a problem hiding this comment.
Modify this class to be something unique like Issue29130ViewModel.
/Users/builder/azdo/_work/1/s/src/Controls/tests/TestCases.HostApp/Issues/Issue29130.cs(88,14): error CS0101: The namespace 'Maui.Controls.Sample.Issues' already contains a definition for 'CollectionViewViewModel' [/Users/builder/azdo/_work/1/s/src/Controls/tests/TestCases.HostApp/Controls.TestCases.HostApp.csproj::TargetFramework=net9.0-maccatalyst]
/Users/builder/azdo/_work/1/s/src/Controls/tests/TestCases.HostApp/Issues/Issue29130.cs(88,14): error CS0101: The namespace 'Maui.Controls.Sample.Issues' already contains a definition for 'CollectionViewViewModel' [/Users/builder/azdo/_work/1/s/src/Controls/tests/TestCases.HostApp/Controls.TestCases.HostApp.csproj::TargetFramework=net9.0-tizen]
/Users/builder/azdo/_work/1/s/src/Controls/tests/TestCases.HostApp/Issues/Issue29130.cs(88,14): error CS0101: The namespace 'Maui.Controls.Sample.Issues' already contains a definition for 'CollectionViewViewModel' [/Users/builder/azdo/_work/1/s/src/Controls/tests/TestCases.HostApp/Controls.TestCases.HostApp.csproj::TargetFramework=net9.0-ios]
/Users/builder/azdo/_work/1/s/src/Controls/tests/TestCases.HostApp/Issues/Issue29130.cs(88,14): error CS0101: The namespace 'Maui.Controls.Sample.Issues' already contains a definition for 'CollectionViewViewModel' [/Users/builder/azdo/_work/1/s/src/Controls/tests/TestCases.HostApp/Controls.TestCases.HostApp.csproj::TargetFramework=net9.0-android]
1 Warning(s)
4 Error(s)
There was a problem hiding this comment.
C:\a\_work\1\s\src\Controls\tests\TestCases.HostApp\Issues\Issue29130.cs(88,14): error CS0101: The namespace 'Maui.Controls.Sample.Issues' already contains a definition for 'CollectionViewViewModel' [C:\a\_work\1\s\src\Controls\tests\TestCases.HostApp\Controls.TestCases.HostApp.csproj::TargetFramework=net9.0-windows10.0.20348.0]
C:\a\_work\1\s\src\Controls\tests\TestCases.HostApp\Issues\Issue29130.cs(88,14): error CS0101: The namespace 'Maui.Controls.Sample.Issues' already contains a definition for 'CollectionViewViewModel' [C:\a\_work\1\s\src\Controls\tests\TestCases.HostApp\Controls.TestCases.HostApp.csproj::TargetFramework=net9.0-windows10.0.19041.0]
2 Error(s)
Could you rename to Issue29130ViewMode?
|
/rebase |
672832b to
1d65ca0
Compare
|
/azp run MAUI-UITests-public |
|
Azure Pipelines successfully started running 1 pipeline(s). |
| } | ||
| } | ||
| } | ||
| public class CollectionViewViewModel |
There was a problem hiding this comment.
C:\a\_work\1\s\src\Controls\tests\TestCases.HostApp\Issues\Issue29130.cs(88,14): error CS0101: The namespace 'Maui.Controls.Sample.Issues' already contains a definition for 'CollectionViewViewModel' [C:\a\_work\1\s\src\Controls\tests\TestCases.HostApp\Controls.TestCases.HostApp.csproj::TargetFramework=net9.0-windows10.0.20348.0]
C:\a\_work\1\s\src\Controls\tests\TestCases.HostApp\Issues\Issue29130.cs(88,14): error CS0101: The namespace 'Maui.Controls.Sample.Issues' already contains a definition for 'CollectionViewViewModel' [C:\a\_work\1\s\src\Controls\tests\TestCases.HostApp\Controls.TestCases.HostApp.csproj::TargetFramework=net9.0-windows10.0.19041.0]
2 Error(s)
Could you rename to Issue29130ViewMode?
|
@jsuarezruiz, I have updated both the fix and the test case. Please review them and let me know if you have any feedback or concerns. |
|
/azp run |
|
Azure Pipelines successfully started running 3 pipeline(s). |
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
…130.cs Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
49c3fd9 to
d609c1e
Compare
|
/azp run MAUI-UITests-public |
|
Azure Pipelines successfully started running 1 pipeline(s). |
b8f2396 to
dc3fdb0
Compare
|
/azp run MAUI-UITests-public |
|
Azure Pipelines successfully started running 1 pipeline(s). |
Hi @PureWeen , In |
0a09df4
into
dotnet:inflight/current
…ls to Apply Correct Sizing (#29496) * Fix for ItemSizing issue * Update ItemsViewController2.cs * Update TemplatedCell2.cs * Update TemplatedCell2.cs * Update TemplatedCell2.cs * commit for itemsize * unwanted changes * commit for testcases * Update Issue29130.cs * ItemSizingStatergy changes * Update ItemsViewController2.cs * Update TemplatedCell2.cs * Changes for review * Update TemplatedCell2.cs * Update src/Controls/src/Core/Handlers/Items2/iOS/TemplatedCell2.cs Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * Update src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue29130.cs Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * Update TemplatedCell2.cs * Update TemplatedCell2.cs * Update Issue29130.cs * commit for template testcases * Handler changes * Update ItemsViewHandler2.iOS.cs * Changes on ReloadData --------- Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
…ls to Apply Correct Sizing (#29496) * Fix for ItemSizing issue * Update ItemsViewController2.cs * Update TemplatedCell2.cs * Update TemplatedCell2.cs * Update TemplatedCell2.cs * commit for itemsize * unwanted changes * commit for testcases * Update Issue29130.cs * ItemSizingStatergy changes * Update ItemsViewController2.cs * Update TemplatedCell2.cs * Changes for review * Update TemplatedCell2.cs * Update src/Controls/src/Core/Handlers/Items2/iOS/TemplatedCell2.cs Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * Update src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue29130.cs Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * Update TemplatedCell2.cs * Update TemplatedCell2.cs * Update Issue29130.cs * commit for template testcases * Handler changes * Update ItemsViewHandler2.iOS.cs * Changes on ReloadData --------- Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
…ls to Apply Correct Sizing (#29496) * Fix for ItemSizing issue * Update ItemsViewController2.cs * Update TemplatedCell2.cs * Update TemplatedCell2.cs * Update TemplatedCell2.cs * commit for itemsize * unwanted changes * commit for testcases * Update Issue29130.cs * ItemSizingStatergy changes * Update ItemsViewController2.cs * Update TemplatedCell2.cs * Changes for review * Update TemplatedCell2.cs * Update src/Controls/src/Core/Handlers/Items2/iOS/TemplatedCell2.cs Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * Update src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue29130.cs Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * Update TemplatedCell2.cs * Update TemplatedCell2.cs * Update Issue29130.cs * commit for template testcases * Handler changes * Update ItemsViewHandler2.iOS.cs * Changes on ReloadData --------- Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
…ls to Apply Correct Sizing (#29496) * Fix for ItemSizing issue * Update ItemsViewController2.cs * Update TemplatedCell2.cs * Update TemplatedCell2.cs * Update TemplatedCell2.cs * commit for itemsize * unwanted changes * commit for testcases * Update Issue29130.cs * ItemSizingStatergy changes * Update ItemsViewController2.cs * Update TemplatedCell2.cs * Changes for review * Update TemplatedCell2.cs * Update src/Controls/src/Core/Handlers/Items2/iOS/TemplatedCell2.cs Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * Update src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue29130.cs Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * Update TemplatedCell2.cs * Update TemplatedCell2.cs * Update Issue29130.cs * commit for template testcases * Handler changes * Update ItemsViewHandler2.iOS.cs * Changes on ReloadData --------- Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
…ls to Apply Correct Sizing (#29496) * Fix for ItemSizing issue * Update ItemsViewController2.cs * Update TemplatedCell2.cs * Update TemplatedCell2.cs * Update TemplatedCell2.cs * commit for itemsize * unwanted changes * commit for testcases * Update Issue29130.cs * ItemSizingStatergy changes * Update ItemsViewController2.cs * Update TemplatedCell2.cs * Changes for review * Update TemplatedCell2.cs * Update src/Controls/src/Core/Handlers/Items2/iOS/TemplatedCell2.cs Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * Update src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue29130.cs Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * Update TemplatedCell2.cs * Update TemplatedCell2.cs * Update Issue29130.cs * commit for template testcases * Handler changes * Update ItemsViewHandler2.iOS.cs * Changes on ReloadData --------- Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
…ls to Apply Correct Sizing (#29496) * Fix for ItemSizing issue * Update ItemsViewController2.cs * Update TemplatedCell2.cs * Update TemplatedCell2.cs * Update TemplatedCell2.cs * commit for itemsize * unwanted changes * commit for testcases * Update Issue29130.cs * ItemSizingStatergy changes * Update ItemsViewController2.cs * Update TemplatedCell2.cs * Changes for review * Update TemplatedCell2.cs * Update src/Controls/src/Core/Handlers/Items2/iOS/TemplatedCell2.cs Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * Update src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue29130.cs Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * Update TemplatedCell2.cs * Update TemplatedCell2.cs * Update Issue29130.cs * commit for template testcases * Handler changes * Update ItemsViewHandler2.iOS.cs * Changes on ReloadData --------- Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Note
Are you waiting for the changes in this PR to be merged?
It would be very helpful if you could test the resulting artifacts from this PR and let us know in a comment if this change resolves your issue. Thank you!
Issue Description
When
CollectionView2usesItemSizingStrategy, the sizing does not update correctly on iOS and macOS platforms.RootCause
In CollectionView2 , ItemsLayout is directly derived from UICollectionViewController , where the ItemSizing is not considered.
Description of Change
In
TemplatedCell2, each cell is measured by a override method calledPreferredLayoutAttributesFittingAttributeswhich will determine the size of each at initial loading , I have restricted the measure for all items whenItemSizingStatergyisMeasureFirstItemand updated the dynamic changes from GetCell inItemsViewController2.Issues Fixed
Fixes #29130
Fixes #23304
Tested the behaviour in the following platforms
Output Screenshot
ItemSizingBefore.mov
ItemSizeAfter.mov