dotnet / maui

.NET MAUI is the .NET Multi-platform App UI, a framework for building native device applications spanning mobile, tablet, and desktop.
https://dot.net/maui
MIT License
22.28k stars 1.76k forks source link

UI not updating GridItemsLayout when Span becomes 1 #26083

Open Natriss opened 3 days ago

Natriss commented 3 days ago

Description

When you set the SizeChanged event of the CollectionView to change the Span of the GridItemsLayout when the CollectionView becomes to small. The UI won't render it properly. This only happens when you go to Span 1. Other values work just fine.

I'm using the latest version of .NET 9 Release and Visual Studio 2022 Preview 17.13.0.

https://github.com/user-attachments/assets/9d2c8394-ddee-472e-97e3-f021013bc5ca

https://github.com/user-attachments/assets/ad6cbe52-edfc-4cd0-ba44-7898641f2cdd

Steps to Reproduce

  1. Create a new MAUI app
  2. Add a CollectionView and add the SizeChanged event in the Code-Behind.
  3. Ad the following code to the event: ```csharp private void RecipeList_SizeChanged(object? sender, EventArgs e) { CollectionView collectionView = sender as CollectionView; GridItemsLayout gridItemsLayout = (GridItemsLayout)collectionView.ItemsLayout; if (collectionView.Width < 1000) { gridItemsLayout.Span = 1; } else { gridItemsLayout.Span = 2; } }
  4. Add the following code to the CollectionView in xaml: ```xml ```

Link to public reproduction project repository

https://github.com/Natriss/GridItemsLayoutSpanIssue

Version with bug

9.0.10 SR1

Is this a regression from previous behavior?

Not sure, did not test other versions

Last version that worked well

Unknown/Other

Affected platforms

Windows

Affected platform versions

Windows 10.0.19041.0

Did you find any workaround?

No response

Relevant log output

similar-issues-ai[bot] commented 3 days ago

We've found some similar issues:

If any of the above are duplicates, please consider closing this issue out and adding additional context in the original issue.

Note: You can give me feedback by 👍 or 👎 this comment.

Ying-6 commented 2 days ago

This issue has been verified using Visual Studio 17.13 Preview 1(9.0.10 & 9.0.0 & 8.0.100). Can repro this issue on Windows platform.

BagavathiPerumal commented 1 day ago

@Natriss, We were unable to fully understand the issue described in your report. Based on the description, it appears you are experiencing a problem where, upon resizing the CollectionView, the span value of the GridItemsLayout changes from 1 to 2, causing the items within the CollectionView to not occupy the full width of the screen. However, we were unable to reproduce this exact issue on our end.

We suspect the issue might involve a scenario where, when the span value is set to 1, the right-side border of the CollectionView item is rendered correctly, but the items inside the CollectionView are not resizing as expected. For clarity, we have attached a video that demonstrates our findings.

Could you please confirm the exact issue you are facing.

https://github.com/user-attachments/assets/9daf60c7-f300-4980-9507-eb54c49c3e25

Natriss commented 1 day ago

@BagavathiPerumal well that video is the issue you're showing. It's indeed not rendering properly on that right side.

I might have not properly described it. I wasn't sure how to describe it. Feel free to update the title that fits better. :3