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
21.97k stars 1.71k forks source link

Incorrect item displayed when window scale and layout value is greater than 100 #23233

Open gauravK996 opened 2 months ago

gauravK996 commented 2 months ago

Description

When the window scale and layout value exceeds 100%, the wrong item is displayed in the CollectionView.

Steps to Reproduce

Steps to Reproduce:

  1. Set the window scale and layout value to greater than 100%.
  2. Observe the items displayed in the CollectionView.

Link to public reproduction project repository

No response

Version with bug

8.0.40 SR5

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

No response

Did you find any workaround?

No

Relevant log output

<CollectionView
      BackgroundColor="White"
      ItemSizingStrategy="MeasureAllItems"
      ItemsSource="{Binding Photos}"
      VerticalScrollBarVisibility="Always">
      <CollectionView.ItemsLayout>
          <GridItemsLayout
              HorizontalItemSpacing="4"
              Orientation="Vertical"
              Span="3"
              VerticalItemSpacing="4" />
      </CollectionView.ItemsLayout>

  </CollectionView>
github-actions[bot] commented 2 months ago

Hi I'm an AI powered bot that finds similar issues based off the issue title.

Please view the issues below to see if they solve your problem, and if the issue describes your problem please consider closing this one and thumbs upping the other issue to help us prioritize it. Thank you!

Open similar issues:

Closed similar issues:

Note: You can give me feedback by thumbs upping or thumbs downing this comment.

Zhanglirong-Winnie commented 2 months ago

This issue has been verified using Visual Studio 17.11.0 Preview 2.1 (8.0.40 & 8.0.60). Can't be reproduced on windows platform. When I set the ratio to greater than 100%, the CollectionView still displays normally.

gauravK996 commented 2 months ago

This issue has been verified using Visual Studio 17.11.0 Preview 2.1 (8.0.40 & 8.0.60). Can't be reproduced on windows platform. When I set the ratio to greater than 100%, the CollectionView still displays normally.

Could you please provide the code snippet you're working with?

gauravK996 commented 2 months ago

Sample - https://github.com/gauravK996/Sample/blob/main/CollectionViewDemos.zip

image => Click on vertical grid

image span set to 3 but it shows only 2 item in a row

image

maximizing or changing window size also flickers item numbers in a rows.

MAUI Version - 8.0.61 SR6.1 (Last version that worked well - 8.0.7)

image

My recommended settings for size 100%, but you can try with different sizes.

gauravK996 commented 2 months ago

<//dpiAware xmlns="http://schemas.microsoft.com/SMI/2005/WindowsSettings">true/PM<//dpiAware> <//dpiAwareness xmlns="http://schemas.microsoft.com/SMI/2016/WindowsSettings">PerMonitorV2, PerMonitor<//dpiAwareness>

Removing this dpi settings from platforms=>windows=> app.manifest will temporarily fix this problem.

Damus765 commented 1 month ago

I'm affected by this issue as well. I was about to fill out a new issue and found this one at the last minute. Here is my setup :

I also made a very simple repro project for this issue : https://github.com/Damus765/MauiCollectionViewIssue

Here is a video of the issue, in case what's happening is not clear enough :

https://github.com/user-attachments/assets/66057ebf-b1db-4df1-bb2e-5da13835e24f

Damus765 commented 1 month ago

Tested this issue using Visual Studio 17.11.0 Preview 4.0 and MAUI 9.0.0-preview.6.24327.7 I can still reproduce the issue.