private void Btn_Add_Click(object sender, RoutedEventArgs e) { var mnglst = new manageShopping { productname = "Add product" }; App._manageshoppings.Add(mnglst); Lbx_shopping_list.SelectedItem = mnglst; Lbx_shopping_list.ScrollIntoView(mnglst); }
//manage suggestion /* private List<shopping> Generatesuggestionlist(int cnt) * { * var lst = new List<shopping>(); * * * for (int i = 0; i < cnt; i++) * { * shopping st = new shopping { name = $"name {i}", imagePath =$"name {i}", benifits = $"benifits{i}" }; * lst.Add(st); * } * * return lst; * } */ private ObservableCollection <manageShopping> GenerateShoppinglist(int cnt) { var lst = new ObservableCollection <manageShopping>(); for (int i = 0; i < cnt; i++) { manageShopping std = new manageShopping { productname = $"name {i}" }; lst.Add(std); } return(lst); }