.Net 9.0.81 Android not rendering WidthRequest on ContentView Element when displayed in a CollectionView
- Dominant language
- C#
- Stars
- 23.3k
- Forks
- 2k
- Avg merge
- 1d 10h
- Merged PRs (30d)
- 297
Description
### Description
I am trying to create a simple custom progress bar control by adjusting the width of a BoxView but cannot get it to work across iOS and Android. Setting the WidthRequest of a child element on a ContentView on Android does not appear to work when the ContentView is added to a CollectionView. If there is a better way to do this I would love to know. Tested in Maui .Net 9.0.81.
The screenshot below shows the attached sample app running on Android not rendering the green progress bar and in some cases even the label isn't rendered. When scrolling the list some items will render correctly but not all. Note that if you include the progress bar at the page level outside of the collection view the progress is rendered correctly.
Android Screen Recording:
https://github.com/user-attachments/assets/5a1f6306-b24c-4ebb-9a2c-0e22590109bd
iOS rendering correctly:
iOS Screen Recording:
https://github.com/user-attachments/assets/2e859d95-defb-46f5-b303-d4b547196641
### Steps to Reproduce
Repository with sample application demonstrating issue can be found here: [https://github.com/brentpbc/ProgressBarTest/tree/main](https://github.com/brentpbc/ProgressBarTest/tree/main)
How to Test
1) Build and Run App
2) Tap Open Progress Bar Test Page on an Android device
3) Progress bar in collection view does not render like on iOS. Putting a progress bar at the page level seems to work.
4) Tapping the Update Pct button will update the percentages which triggers a property change on each item which seems to trigger a rerender however the progress bars still render incorrectly when you scroll.
### Link to public reproduction project repository
https://github.com/brentpbc/ProgressBarTest/tree/main
### Version with bug
9.0.81 SR8.1
### Is this a regression from previous behavior?
No, this is something new
### Last version that worked well
Unknown/Other
### Affected platforms
Android
### Affected platform versions
_No response_
### Did you find any workaround?
I have not found a workaround.
### Relevant log output
```shell
```
Contributor guide
Assessment
This issue has not been assessed yet.