I have the following
<CollectionView Margin="5" ItemsSource="{Binding Subjects}">
<CollectionView.ItemsLayout>
<GridItemsLayout Orientation="Vertical" Span="2" />
</CollectionView.ItemsLayout>
<CollectionView.EmptyView>
<ContentView>
<Label Text="No subjects entered yet..." />
</ContentView>
</CollectionView.EmptyView>
<CollectionView.ItemTemplate>
<DataTemplate>
<Border MaximumWidthRequest="300">
<Border.StrokeShape>
<RoundRectangle CornerRadius="10" />
</Border.StrokeShape>
<Border.GestureRecognizers>
<TapGestureRecognizer Command="{Binding Source={RelativeSource AncestorType={x:Type vm:MainPageViewModel}}, Path=DeleteSubjectCommand}" CommandParameter="{Binding .}" />
</Border.GestureRecognizers>
<Label Margin="5" Text="{Binding .}" />
</Border>
</DataTemplate>
</CollectionView.ItemTemplate>
</CollectionView>
The problem is that the <Label Margin="5" Text="{Binding .}" /> is blank in release in my .NET MAUI Android application while in debug, it is populated and the gesture recogniser works.
When I add items to the list, the correct number of items appears so it leads me to think that there is something happening with the label highlighted above.
How do I solve this?
... Text="This is a test" />, does the text show? * If you remove the border and its recognizer, so datatemplate is simply<Label ... />, does the bound text show? * Add c# code: Subjects declaration, code that sets Subjects or adds its items * is that code called from constructor? OnAppearing? inside anasyncmethod?