I tried to associate a list of objects with listviewfor a long time, but although it works as expected in lists where I do not need to write an itemtemplate (for example ObservableCollection<string>), it does not work with lists where I want itembindingthe object field in list:
MainPage.xaml.cs:
ExampleList = new ObservableCollection<ExampleItem>()
{
new ExampleItem() {Showing = "Item 1"},
new ExampleItem() {Showing = "Item 2"}
};
ListView.ItemsSource = ExampleList;
MainPage.xaml:
<ListView x:Name="ListView">
<ListView.ItemTemplate>
<DataTemplate>
<TextCell Text="{Binding Showing}" TextColor="White"></TextCell>
</DataTemplate>
</ListView.ItemTemplate>
</ListView>
Although there are elements of the list (!), The text in the lines simply does not appear:
Binding Result
I already tried this solution, the result was the same: Xamarin ListView did not display any data
How can I do this job? Thanks in advance!
EDIT:
It seems that the binding does not work (completely) with fields, variables should be properties !