ListView/CollectionView faulty height calculation in Grid with multiple columns #21974
Labels
area-controls-listview
ListView and TableView
area-layout
StackLayout, GridLayout, ContentView, AbsoluteLayout, FlexLayout, ContentPresenter
layout-grid
migration-compatibility
Xamarin.Forms to .NET MAUI Migration, Upgrade Assistant, Try-Convert
platform/android 🤖
platform/windows 🪟
t/bug
Something isn't working
Milestone
Description
In a Grid with one RowDefinition with width = auto, and a second one with width = star, the height of the ListView (or CollectionView, maybe ScrollView too) is not calculated correctly on Windows and Android. The issue is not present using MAUI on iOS, and was not present on any platform in XF.
In this example the ListView is always as big as the Grid containing the ListView, even though the Label has a height of 50 and the ListView should shrink to accommodate it. In this case the Label will usually be overlayed, so that the bottom part of the ListView is not visible. On Windows the ListView is sometimes visible, and the label is invisible instead.
Adding additional grid rows above or below the list contribute to the issue further.
In other constellations like:
and
the issue is not present.
With two ColumnDefinitions:
![grafik](https://private-user-images.githubusercontent.com/26375892/324458200-b2b292f8-6289-468a-b744-5f54dbc2d3af.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjA1MjY1MDUsIm5iZiI6MTcyMDUyNjIwNSwicGF0aCI6Ii8yNjM3NTg5Mi8zMjQ0NTgyMDAtYjJiMjkyZjgtNjI4OS00NjhhLWI3NDQtNWY1NGRiYzJkM2FmLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA3MDklMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwNzA5VDExNTY0NVomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPWJlYWEyNjhmMGFjNjNmNmM0NjFkZGE5NjJmYWQ1NTk2NGU4YTQzNWFhMzU4MTk5NTY3ZTUzNDczMzgxZjUzYTQmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.j4q0qkq3voRmrlTa6oRj_S1DyN6ONWJUK_MabLBeF3g)
Without the second ColumnDefinition:
![grafik](https://private-user-images.githubusercontent.com/26375892/324458626-11aec6b2-2b64-45dd-8440-88031080a599.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjA1MjY1MDUsIm5iZiI6MTcyMDUyNjIwNSwicGF0aCI6Ii8yNjM3NTg5Mi8zMjQ0NTg2MjYtMTFhZWM2YjItMmI2NC00NWRkLTg0NDAtODgwMzEwODBhNTk5LnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA3MDklMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwNzA5VDExNTY0NVomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTlmMDUwODFjY2I3ZDBhYTg5MzlkNjg5ZDljM2Y3YjFkMzliMzk3NzRlODg5MDUxOTlmZmYwNzg0ZjJjYzIwOWEmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.rV6YkpBD902ipBitjCuLR1voNW1iVsgOQ-psVyPFu4M)
Steps to Reproduce
Observed behavior:
![grafik](https://private-user-images.githubusercontent.com/26375892/324458200-b2b292f8-6289-468a-b744-5f54dbc2d3af.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjA1MjY1MDUsIm5iZiI6MTcyMDUyNjIwNSwicGF0aCI6Ii8yNjM3NTg5Mi8zMjQ0NTgyMDAtYjJiMjkyZjgtNjI4OS00NjhhLWI3NDQtNWY1NGRiYzJkM2FmLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA3MDklMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwNzA5VDExNTY0NVomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPWJlYWEyNjhmMGFjNjNmNmM0NjFkZGE5NjJmYWQ1NTk2NGU4YTQzNWFhMzU4MTk5NTY3ZTUzNDczMzgxZjUzYTQmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.j4q0qkq3voRmrlTa6oRj_S1DyN6ONWJUK_MabLBeF3g)
The last entry is not visible, even after scrolling all the way down.
Expected behavior:
![grafik](https://private-user-images.githubusercontent.com/26375892/324458626-11aec6b2-2b64-45dd-8440-88031080a599.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjA1MjY1MDUsIm5iZiI6MTcyMDUyNjIwNSwicGF0aCI6Ii8yNjM3NTg5Mi8zMjQ0NTg2MjYtMTFhZWM2YjItMmI2NC00NWRkLTg0NDAtODgwMzEwODBhNTk5LnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA3MDklMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwNzA5VDExNTY0NVomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTlmMDUwODFjY2I3ZDBhYTg5MzlkNjg5ZDljM2Y3YjFkMzliMzk3NzRlODg5MDUxOTlmZmYwNzg0ZjJjYzIwOWEmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.rV6YkpBD902ipBitjCuLR1voNW1iVsgOQ-psVyPFu4M)
The last entry is visible on the bottom of the ListView after scrolling all the way down:
Link to public reproduction project repository
No response
Version with bug
8.0.20 SR4
Is this a regression from previous behavior?
Yes, this used to work in Xamarin.Forms
Last version that worked well
Unknown/Other
Affected platforms
Android, Windows
Affected platform versions
Android 14, Windows 11-SDK 10.22621.0
Did you find any workaround?
No response
Relevant log output
No response
The text was updated successfully, but these errors were encountered: