public MainPage() { InitializeComponent(); SearchIngredients = new List <IngredientDtoV2>(); MyIngredients = User.User.SavedIngredinets; foreach (var ingredient in MyIngredients) { MyIngredientModels.Add(new IngredientListModel() { Ingredient = ingredient, IsAdded = true }); } ExcludedIngredients = User.User.SavedExcludedIngredinets; foreach (var ingredient in ExcludedIngredients) { ExcludedIngredientModels.Add(new IngredientListModel() { Ingredient = ingredient, IsAdded = true }); } NoIngredientsError = false; XamlSetup(); BindingContext = this; }
// --------------------------------------------- SPAGHETTI --------------------------------------------------- void GenerateMyIngredientModels() { MyIngredientModels.Clear(); foreach (var ingredient in MyIngredients) { MyIngredientModels.Add(new IngredientListModel { Ingredient = ingredient, IsAdded = true }); } Sorting.ResizeListView(ListView_myIngredients, MyIngredients.Count); }