maui
maui copied to clipboard
XAML ContentPage.Content required for data to appear.
Description
During testing I was having a problem with data not showing in a very simple CollectionView. After a few attempts I discovered that if the XAML <ContentPage.Content> section is a any StackLayout. The data will not appear in the bound collectoin view.
Per the MS instructions:
The Content property isn't required in XAML because elements defined for use in .NET MAUI XAML are allowed to have one property specified as the ContentProperty attribute on the class:
Steps to Reproduce
New Project... Place a CollectionView inside of any stack layout that is the primary content element. Bind the collection view ItemsSource property to a class and the contents will not show, despite having several items in the source.
Link to public reproduction project repository
No response
Version with bug
8.0.3 GA
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
Affected platform versions
No response
Did you find any workaround?
Use ContentPage.Content and it appear to no longer have issues.
Relevant log output
No response
Can you please provide some code to demonstrate what you mean? I don't think this has to do with having to specify the Content property, but more with wrapping a CollectionView inside of a StackLayout and then the size not being updated accordingly.
For more information about layouts, please see: https://github.com/dotnet/maui/blob/main/docs/design/layout.md
Hi @StewBash. We have added the "s/needs-info" label to this issue, which indicates that we have an open question for you before we can take further action. This issue will be closed automatically in 7 days if we do not hear back from you by then - please feel free to re-open it if you come back to this issue after that time.
This issue has been automatically marked as stale because it has been marked as requiring author feedback but has not had any activity for 4 days. It will be closed if no further activity occurs within 3 days of this comment. If it is closed, feel free to comment when you are able to provide the additional information and we will re-investigate.
This issue has been automatically marked as stale because it has been marked as requiring author feedback but has not had any activity for 4 days. It will be closed if no further activity occurs within 3 days of this comment. If it is closed, feel free to comment when you are able to provide the additional information and we will re-investigate.