Following this tutorial: https://learn.microsoft.com/pl-pl/xamarin/xamarin-forms/user-interface/listview/data-and-databinding
i'm getting this exeption:
System.NullReferenceException: 'Object reference not set to an instance of an object.'
in line: CategoryListView.ItemsSource = _category;
in the tutorial there is a warning which i guess is assiocciated with my problem, but i still have no clue how to solve the problem(i don't fully understand the warning)
namespace EduApp { [XamlCompilation(XamlCompilationOptions.Compile)] public partial class QUIZListViewPage : ContentPage
{
ObservableCollection<Category> _category = new ObservableCollection<Category>();
//public ObservableCollection<Category> _Category { get { return _category; } }
public QUIZListViewPage()
{
CategoryListView.ItemsSource = _category;
_category.Add(new Category { categoryName = "first" });
InitializeComponent();
}
}
}
TY in advanced C: