viewmodel, model and code behind
Hello Community,
need help with data bindings recognizing the MVVM pattern in a ListView in XAML. I don't know why it doesn't work. I can't see any data on the view. I have got only this Exception through debugging.
Xamarin.Forms.Xaml.XamlParseException: Position 8:10. Property Content is null or is not IEnumerable
Thanks for answers.
XAML
<ViewCell>
<StackLayout HorizontalOptions="FillAndExpand" Orientation="Horizontal">
<StackLayout HorizontalOptions="Start" Orientation="Vertical">
<Label Text="{Binding Name}" />
</StackLayout>
<StackLayout HorizontalOptions="End" Orientation="Vertical">
<Label Text="{Binding Information}" />
</StackLayout>
</StackLayout>
</ViewCell>
Code
public partial class PartyStatusPage : ContentPage
{
public PartyStatusPage()
{
InitializeComponent();
}
protected override void OnAppearing()
{
base.OnAppearing();
BindingContext = new PartyStatusPageViewModel();
}
}
public class PartyStatusPageViewModel
{
public List<PartyStatus> ItemList;
public PartyStatusPageViewModel()
{
ItemList = new List<PartyStatus>();
ItemList.Add(new PartyStatus { Name = "Max", Information = "test" });
}
}
public class PartyStatus
{
public string Name { get; set; }
public string Information { get; set; }
public bool State { get; set; }
}