/// <summary> /// View details of recipe /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void View_Click(object sender, RoutedEventArgs e) { View.Visibility = Visibility.Visible; Main.Visibility = Visibility.Hidden; int i = datagrid.SelectedIndex; Name.Text = recipe[i].name; Prep_time.Text = "preparation time: " + recipe[i].prep_time.ToString(); Num_serves.Text = "Number of Serves: " + recipe[i].Num_serves.ToString(); Method.AppendText(recipe[i].method); List <ingredients> ingredient = new List <ingredients>(); ingredient = recipe[i].Ingredients; for (int j = 0; j < ingredient.Count; j++) { ingredients.Items.Add(ingredient[j].getIngredient() + " " + ingredient[j].getAmount()); } }