public Ex_Cat_List() { InitializeComponent(); Ex_Cat_database = new Ex_CategoryController(); ExpenseCategories = new ObservableCollection <ExpensesCategory>(Ex_Cat_database.GetCategories()); _Ex_Cats.ItemsSource = ExpenseCategories; }
//private App app = new App(); public AddExpense() { InitializeComponent(); foreach (var item in catdatabase.GetCategories()) { catList.Add(item.Name); } ExCatList.ItemsSource = catList; }
public EditExpenses(Expense expense) { InitializeComponent(); Ex_Cats = new ObservableCollection <ExpensesCategory>(ex_cat_database.GetCategories()); Exp = expense; BindingContext = expense; pickerCatsEx.ItemsSource = Ex_Cats; //finding the saved item from categories(workaround) int c = 0; foreach (var item in Ex_Cats) { if (item.Name == expense.Category) //where the saved category is the same as on the picker { pickerCatsEx.SelectedIndex = c; //get the index and select the item on the picker } c++; //increase counter on the list } }